Reasons that cannot be invoked outside Ajax internal values and how to solve them
var id= ' 123 ';
$.ajax ({
URL: ' Http://www.xxx.com/ajax ',
type: ' Post ',
dataType: ' json ',
data:{wurl:w_url,murl:m_ URL},
Async:turn,
error:function () {
},
success:function (data) {
var id= data[' id '];
Console.log (ID)//Here Come out is the {}
})
Console.log (ID); it's 123 out here.
The problem is on the Ajax async sync Step option, if the async:false is to be run synchronously, the AJAX load completes and then executes the following statement. If Async:turn, it means asynchronous execution, and Ajax will have a chance to entertain the next step of Ajax when the value is not on the line.
The above Ajax internal value outside of the call reason and solution is small series to share all the content, hope to give you a reference, also hope that we support cloud habitat community.