Ajax call in jquery use
-
urlType: StringA string containing the URL to which the request is sent.
-
async (default:
true
)Type: BooleanBy default, all requests are sent asynchronously (i.e. this is set totrue
by default). If you need synchronous requests, set this option tofalse
. Cross-domain requests anddataType: "jsonp"
requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active.
-
cache (default:
true, false for dataType 'script' and 'jsonp'
)Type: BooleanIf set tofalse
, it will force requested pages not to be cached by the browser.
-
contentType (default:
'application/x-www-form-urlencoded; charset=UTF-8'
)Type: StringWhen sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases.
$.ajax({
type: "POST",
url: "../Pagename.aspx/user",
data: JSON.stringify({ userId: 1, status: 1 }),
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
success: function (data) {
//do logic
}
});
type: "POST",
url: "../Pagename.aspx/user",
data: JSON.stringify({ userId: 1, status: 1 }),
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
success: function (data) {
//do logic
}
});
No comments:
Post a Comment