Ajax example on the entry and
Related Tags:
Foreword:
Ajax technology has been fire for a period of time, but really not using ajax Web site, and the use of the Web site to ajax technology google represented, such as Google launches Gmail, the wider use of local refresh technology, is using the Ajax technology.
As we all know, strictly speaking procedures are desktop applications and Web applications, desktop applications providing rich user interfaces, such as good-looking pages do not refresh. And web access server applications need to refresh pages, waiting for the request and then re-created pages to be added.
I do not know how you feel, I do B / S software to refresh this page feel very uncomfortable.
Well, we ajax below to the technical analysis and gives an example.
1. What is ajax
Ajax: Asynchronous JavaScript And XML (Asynchronous JavaScript and XML) acronym.
As far as I know and peer response ajax is not a new technology (as we said a bit like old wine in a new bottle with the feeling You…)
But many technical collection (as a framework for an integrated several technical ah, You…). Ajax use of communications technology (usually SOAP and XML) to the server to send and receive asynchronous request / response, and then use Display technology (JavaScript, DOM, HTML, and CSS) treatment response.
Ajax allow you to call through the implementation of server-side JavaScript, without the need for refreshing the browser.
Well, let us use ajax technology through a small procedure to learn ajax and it deeply in love with her.
2. Examples
2.1 downloaded from the website ajax.net ajax.dll document (I use the VS.net 2005, the download is AjaxPro.2.dll)
2.2 in the project cited AjaxPro.2.dll
2.3 web.config file amended by adding:
<system.web>
<httpHandlers>
<! - Register the ajax handler ->
<add Verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro.2"/>
</ HttpHandlers>
</ System.web>
2.4 In order to make the server-side function in JavaScript can be used, must do two things. First, we should use the function to be marked Ajax.AjaxMethodAttribute. Secondly, in the page loading during the incident must be registered by calling Ajax.Utility.RegisterTypeForAjax contain these functions to the class:
Protected void Page_Load (object sender, EventArgs e)
(
AjaxPro.Utility.RegisterTypeForAjax (typeof (_Default)); / / registration
)
[AjaxPro.AjaxMethod]
Public int MySum (int a, int b)
(
Return a + b;
)
2.5 client javascript:
<form Id="form1" runat="server">
<div>
<input Id="txtA" type="text" onchange=" Jsum ()"/>
+
<input Id="txtB" type="text" onchange=" Jsum ()"/>
=
<input Id="result" type="text" />
</ Div>
</ Form>
<script Type="text/javascript">
Function Jsum ()
(
Var a = document.getElementById ( 'txtA'). Value;
Var b = document.getElementById ( 'txtB'). Value;
Var a1 = parseInt (a);
Var b1 = parseInt (b);
_Default. MySum (a1, b1, getSum_callback);
)
Function getSum_callback (rel)
(
Document.getElementById ( "result"). Value = rel.value;
)
</ Script>
Well, the use of this technology ajax small procedure OK.
Of course, using ajax technology also can handle complex data conversion, transmission. If you read the article can be deeply in love with
Ajax is my purpose. I think you will study it, You ...
Ajax I was studying, learning and research that want ajax technology counterparts to explore a newer and deeper things, my QQ: 66765550
Resources freebee: ajax.dll Download: http://www.schwarz-interactive.de/
- The best example Break CSS CSS Guide (c)
- DIV + CSS layout entry Example (5) border and clear
- The best example Break CSS CSS Guide (2)
- CSS Example: underlining the pattern of input box
- DIV + CSS layout entry Example (3) the top of the page production
- CSS Form Example: with a small icon of cool CSS form design!
- DIV CSS layout entry Example (2) into the overall structure and CSS
- A good example HTML + CSS menu
- The best example Break CSS CSS Guide (1)
- CSS Example: UL li create CSS horizontal menu blue horizon
- DIV CSS-out navigation for example, the analytical cool!
- CSS layout used in the CSS image replacement, alternative methods, for example picture
- CSS Example: Community Head CSS effect kijiji
- JS visit meta example and css
- CSS + DIV simple example
- CSS example
- CSS wonderful example for (b)
- DIV + CSS layout entry Example (1) page layout and planning
- Create stars with the CSS score an example of results
- DIV + CSS layout entry Example (2) into the overall structure and CSS




