Note: Must be changed to write: "{" Success ": true," MESG ":" Success "}", if it is bool type, without quotes, the other keys/values need to be quoted. "
$.ajax ({
..
DataType: ' JSON ',
...
Success:function (JSON) {
Do not perform success
},
Error:function (Error) {
Always execute this error
}
});
Commonly used is the $get (Url,data,callback,type) method
Where the URL is a page for the asynchronous request (which can be a. ashx file), data is a parameter, callback is a callback function, and type is the type that returns the data. Type has xml,html,json,text etc.
First, the page references Jquery.js
Write the JS function for AJAX processing on the page
function initmeeting () {
$.get ("/common/meetingroom.ashx", {meetid:<%=meetid%>},function sellerlist (data) {
$ ("#divSellerList"). HTML (data);
}, "JSON");
SetTimeout ("initmeeting ()", 20000);
}
function initmeeting () {
$.get ("/common/meetingroom.ashx", {meetid:<%=meetid%>},function sellerlist (data) {
var obj = eval ("(+ Data +)"); the converted JSON object
$ ("#divSellerList"). html (obj. Cellerlist);
}, "html");
SetTimeout ("initmeeting ()", 20000);
}
The return type I use is JSON, which returns a data type similar to the class. {"Name": "Sunny d.d", "Age": 25}
But when you use the return value data, you first convert JSON by
var obj = eval ("(+ Data +)"); the converted JSON object
You can get the JSON object.