and to use ajax jQurey

1, when used for an introduction jQurey jquery-1.4.2.js at web folder

And the need to define script tag as follows when writing the script:

<script src="js/jquery-1.4.2.js" type="text/javascript"></script>

2, jQurey syntax: by $ (To select elements)

ajax use forms as follows:

.ajax $ ({ 
       URL: "/ AJAX_war_exploded / the ClickServlet", // definition of the need to go to the Servlet 
       type: "POST",                // definition of the form submission 
       Data: {                   // the data to be transferred is defined, in the form of key-value pairs storage 
         buttonName: "button_2" 
       },                     // each ajax Servlet will make a return data 
       dataType: "json",             // define the return data type of 
       Success: function (the Result) {       // ajax return data received the event will trigger Success 
         var = First result.first; 
         var SECOND, = result.second; 
         var THIRD, = result.third;
         $ ( ".First") [0] = First .innerHTML;    // this form using jQuery obtain html elements 
         $ ( "SECOND.") [0] = .innerHTML SECOND; 
         $ ( ".third") [0] = .innerHTML THIRD; 
       } 
     }) 
   })

Guess you like

Origin www.cnblogs.com/shouyaya/p/12041589.html