| The code is as follows |
Copy Code |
$.post (' <%=this. AppPath%>dataservice/inventoryuiservice.svc/rename ',///location.protocol + "//" + Location.host + Location.pathname + "/rename",
OData
function (Result) {
$dialogProcessing. Dialog ("Close");
if (result. Success) {
Alert ("Success");
}
else {
var msg = "Your Submit Fauiler, Detail message was:" + result. errormessage;
Window.alert (msg);
}
},
"JSON");
$.ajax ({
URL: ' <%=this. AppPath%>dataservice/inventoryuiservice.svc/rename ',
Type: ' POST ',
ContentType: ' Application/json ',
DataType: ' JSON ',
Data:odata,
Success:function (Result) {
if (result. Success) {
Alert ("Success");
}
else {
var msg = "Your Submit Fauiler, Detail message was:" + result. errormessage;
Window.alert (msg);
}
},
Error:function (JQXHR, Textstatus, Errorthrown) {
var msg = "Your Submit throw a error, Rnerror message is:" + $ (jqxhr.responsetext). text ();
Window.alert (msg);
}
});
|
$.post is used to submit forms, and access to WCF Ajax service must be $.ajax to specify Content-type
You can ' t send application/json directly--it has to be a parameter of a get/post request.
So something like
| code is as follows |
copy code |
|
$.post (URL , {json: "... json ..."}, function ()); |