On the problem of Ajax does not take the callback function __ function

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.