08/18 : Call Web Service With Jquery
Jquery code In .Net 2.0/.Net 3.5
Need to add .d (data) to get data of return result in .Net 3.5
2.0:
$.ajax({
type: "POST", //POST
url: "GridViewDrillDownjQueryAjax.aspx/GetOrders", //Set call to Page Method
data: params, // Set Method Params
beforeSend: function(xhr) {
xhr.setRequestHeader("Content-type", "application/json; charset=utf-8");
},
contentType: "application/json; charset=utf-8", //Set Content-Type
dataType: "json", // Set return Data Type
success: function(msg, status) {
alert(msg);
$('#progress').css('visibility', 'hidden');
$(master).children()[0].src = src;
$(detail).html(msg); $(detail).slideToggle("normal"); // Succes Callback
},
error: function(xhr, msg, e) {
alert(msg); //Error Callback
}
});
3.5
$.ajax({
type: "POST", //POST
url: "GridViewDrillDownjQueryAjax.aspx/GetOrders", //Set call to Page Method
data: params, // Set Method Params
beforeSend: function(xhr) {
xhr.setRequestHeader("Content-type", "application/json; charset=utf-8");
},
contentType: "application/json; charset=utf-8", //Set Content-Type
dataType: "json", // Set return Data Type
success: function(msg, status) {
alert(msg);
$('#progress').css('visibility', 'hidden');
$(master).children()[0].src = src;
$(detail).html(msg.d); // d means data $(detail).slideToggle("normal"); // Succes Callback
},
error: function(xhr, msg, e) {
alert(msg); //Error Callback
}
});
0 Comments:
Post a Comment
<< Home