Jquery encapsulation method Ajax call to obtain the returned JSON data method

Source: Internet
Author: User

Because I am tired of writing Ajax and the development speed is slow, I have integrated the jquery class library and integrated it into the development project shamelessly. 0.0 the following are the $. Ajax ({data}) method in jquery to return JSON data.

The jquery Ajax method obtains asynchronous data. Currently, system. Web. Script. serialization is referenced on the Framework 3.5 platform. JSON data can also be obtained. Today we are writing about the implementation based on the Framework 2.0 platform.

 
// Background data protected void page_load (Object sender, eventargs e) {response. clear (); response. write ("{status: 'y', message: 'returned data status is y'}"); response. end ();}
 
<SCRIPT type = "text/JavaScript"> $ ("# BTN "). click (function () {$. ajax ({type: "Get", URL: "ajax_sources.aspx", cache: True, success: excute}) ;}( "# Div "). ajaxsend (function () {response (this%.html ("sending request ..... ") ;}); function excute (data) {eval (" Var DATA = ". concat (data); // note this. S if (data. Status = "Y") {alert (data. Message) ;}}</SCRIPT>
    </pead>  
   
   
  
Related Article

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.