Just started to intervene in programming, a lot of things can not be done on their own, just started to make a lot of mistakes.
Use the CSDN blog as your own notes.
Today, using JQuery's post to submit data, I need to use the data he returned,
[JavaScript] view Plaincopyprint?
jquery.post (url+'/usertag/option/deltag/index/'+index,
function (JSON) {
Console.log (JSON);
Console.log (Json.data);
});
When I look at the input data in the console, I get the JSON, but Json.data is undefined.
{"Status": 1, "info": "\u5220\u9664\u6210\u529f", "Data": "1"}
Undefined
Just start getting started, so it feels right to look at it. Why not call his attributes?
Google search for a bit, the results only found that I got a JSON string ... is not an object at all, how to invoke its properties?
So you need to change it, the workaround, declares that the return value is of type JSON because there is no write return to the "JSON" type, which returns a string type.
[JavaScript] view Plaincopyprint?
jquery.post (url+'/usertag/option/deltag/index/'+index,
function (JSON) {
Console.log (JSON);
Console.log (Json.data);
},' json ');
OK, this is right, the front of the object several large characters in front, but also not justified.
Hey, beginner programming is to eat a bit more bugs, or there will be no progress.
JSON returned using the jquery post submission data is a string that cannot be parsed as a JSON object