admin管理员组文章数量:1323714
I have a problem with printing Ajax success data.
success: function(data){
alert(need to print it here);
}
How it es when I access
console.log(data.responseText);
{"success":false,"errors":{"text":["Some text.","some more text"]}}
How can I alert "Some text" or "some more text" now? Thanks
I have a problem with printing Ajax success data.
success: function(data){
alert(need to print it here);
}
How it es when I access
console.log(data.responseText);
{"success":false,"errors":{"text":["Some text.","some more text"]}}
How can I alert "Some text" or "some more text" now? Thanks
Share Improve this question edited Nov 8, 2013 at 18:35 웃웃웃웃웃 12k15 gold badges62 silver badges94 bronze badges asked Nov 8, 2013 at 18:20 Plic PlPlic Pl 5513 gold badges7 silver badges17 bronze badges3 Answers
Reset to default 2alert data
success: function(data){
alert(data);
}
write to div tag
<div id="mydiv"></div>
success: function(data){
document.getElementById("mydiv").innerHTML += data;
}
Say you have a div to print the result like
<div id="res_div"></div>
You can access the contents by
console.log(data.responseText.errors.text);
You just try the following to print the content to that div
$("#res_div").text(data.responseText.errors.text);
Just drill down the data
object to the errors.text
array and loop through them, like this:
$.each(data.responseText.errors.text, function(index, item) {
alert(item);
});
本文标签: javaPrint AJAX Success DataStack Overflow
版权声明:本文标题:java - Print AJAX Success Data? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742127492a2422008.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论