Possible Duplicate:
return from jquery ajax call
jQuery: Return data after ajax call success
$.ajax({
url:"list.php",
dataType: "json",
success: function(resp){
for(var i=0;i $('#goods_list').append(
"" + resp[i]["name"] + "
"
+
""
);
}
var resp2 = resp;
}
});
$('body').append(resp2[0]["price"]);
And FireBug said:
ReferenceError: resp2 is not defined
$('body').append(resp2[0]["price"]);
How can I use $.ajax success data in somewhere else? (outside the $.ajax function)
The concept is similar to "Global Variables".
No comments:
Post a Comment