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/ 




Related articles:

Simple and practical skills of the Web-based form effects
  A color dotted line forms    <style Type="text/css">    <! --    . Tab1 (    Border-top-width: thin;    Border-right-width: thin;    Border-bottom-width: thin;    Border-left-width: thin;  &...
In the elegant hair Flash animation
  Figure complete results:    From a recent practice, I would like to share with you the process ~ ~ better practices even tell!    First, the first personal painting, the chart.    Like paintings that draw on what form (this does not matter, here is mainly the ...
Better File Uploads with AJAX and JavaServer Faces
  Browser-based file uploads, in particular those involving the HTML <input type="file"> tag, have always been rather lacking. As I am sure most of you are aware, uploading files exceeding 10MB often causes a very poor user experience. Once a user submits the file, the browser ...
CSS Tutorial 13, the CSS display attributes [Translation Htmldog]
  HTML operation is the key element to understand their working methods is no specific form.    By labelling some of the most pages can be set any pattern.    The browser's default style, the majority of html elements from the font style, margin, padding component, in e...
Flash Lite use of Flash animation will be transplanted to the best practice of mobile phones
  I attended last year in November in New Orleans at the Macromedia MAX General Assembly, when I got home, I am exhausted.    I understand that a lot of Macromedia Flash technology in the integrated mobile devices to the progress of this integrated mobile users can bring attractive a...