Ajax is the set return value is clearly JSON format, but the return value is JSON format can not receive. To be received without setting the text format.
Here's my jquery code:
function Addsku (ID) {
var m=$ ("#m" +id+ ""). Val ();
var p=$ ("#p" +id+ ""). Val ();
var i=$ ("#i" +id+ ""). Val ();
var l=$ ("#l" +id+ ""). Val ();
var f=$ ("#f" +id+ ""). Val ();
$.ajax ({
URL: "/console/sku/update.action",
DataType: "JSON",
Type: "Post",
data:{"Marketprice": M, "Price":p, "the stock": I, "upperlimit": L, "Delivefee": F, "id": ID},
Success:function (data) {
alert (data);
$ ("#m" +id+ ""). attr ("Disabled", true);
$ ("#p" +id+ ""). attr ("Disabled", true);
$ ("#i" +id+ ""). attr ("Disabled", true);
$ ("#l" +id+ ""). attr ("Disabled", true);
$ ("#f" +id+ ""). attr ("Disabled", true);
}
});
}
This is the controller layer code.
Modify Inventory
@RequestMapping (value= "/console/sku/update.action")
Public @ResponseBody String Updatesku (Sku sku,httpservletresponse response) throws ioexception{
Skuservice.updatesku (SKU);
return "OK";
}
The final solution is to modify jquery's Ajax return value type is text to solve, but the reason I do not know, I am exploring, if there are known friends can DMS me. Thank you.