JQuery AJax calls asp.net WebServers and returns a json Summary

Source: Internet
Author: User

I 've been engaged in this thing for a long time, recording it down, saving the trouble

1. return format: return "{\" msg \ ": \" "+ message +" \ ", \" msg2 \": \ "" + message2 + "\"} ", which seems to have to be returned. I use string. format, but I can't even write it down.

 

2. the return value is inexplicably cached. I modified the return value and returned the previous value. I was almost tortured by this problem and found that I could only recycle the IIS application pool.

 

3. To call a method, you must use eval to convert it. In addition, I can search for. net3.5 and 2.0 to convert it. I use 3.5.

$. Ajax ({
Type: "post ",
Url: "/Service/post. asmx/BindPersonal ",
Data :"{}",
Datatype: "json ",
ContentType: "application/json; charset = UTF-8 ",
Success: function (result ){
Var realobj = eval ('+ result + ')');
Alert (realobj. msg );

Alert (realobj. msg2 );

},
Error: function (x, e ){
Alert (x. responseText );
}
});

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.