Ajax Asynchronous Refresh detailed application (website response speed optimization)

Source: Internet
Author: User

Try Ajax written in jquery to flush asynchronously and organize HTML documents

$ ("Li.mod_cate"). Bind ("MouseOver", function () {///resolve the problem that the mouse moves to the submodule will also trigger Ajax     var type  = $ (This). attr ("name");  $.ajax ("url" +type+ "/", {    datatype:  " Jsonp ",    data: " ",    success: function  (JSON)  {         var jsondata = json.data1;         var txtHtml1 =  "";         for  (var i = 0; i < jsondata.length; i++)  {             if  (jsondata[i].value1.length != 0) {                var  txthtml2 =  "<li><table><tr><td>" +jsondata[i].colname+ "</td><td> <ul> ";                 var t1 =  "";                 for  (Var  j = 0; j < jsondata[i].value1.length; j++) {                     var  txthtml3 =  "<li><a href=\"/books/"+jsondata[i].value1[j].colid+jsondata[i].colname+"/" +jsondata[i].value1[j].colname+ "\" > "+jsondata[i].value1[j].colname+" </a></li> ";                      var t1 = t1 + txthtml3;                 }                 var t3 = txthtml2+t1+ "</ul></td></tr></table></li>";}             else{             var t3 =  "<li><table><tr><td> "+jsondata[i].colname+" </td></tr></table></li> ";         }            var txthtml1 =  txthtml1+t3};        $ ("#" +type). HTML (TXTHTML1);  //Custom Selector (&NBSP;&NBSP;&NBSP;&NBSP;});}). On ("Mouseout", function () {    $ (this). Unbind ("MouseOver");  //solve the problem that the mouse moves to the submodule will also trigger Ajax});

Background JSON

Javascriptfunction = request.args["Callback"]return Javascriptfunction + "(" + json.dumps (kinds) + ");"


Ajax Asynchronous Refresh detailed application (website response speed optimization)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.