我第一次写的AJAX与JSON方法,有点不懂怎么弄的呢,恳请各位老师帮忙说解,由于什么原因出错的?<!DOCTYPE html><html><head><script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script><script> $(function () { $("button").click(function(){ $.ajax({ url:"http://www.tutorialspoint.com/json/data.json", type:"POST", dataType: "json", success:function(data){ $("#name").html(data.name); $("#country").html(data.country); }, error: function (err) { console.log(err) } }); }) });</script><title>tutorialspoint.com JSON</title></head><body><h1>Cricketer Details</h1><table class="src"><tr><th>Name</th><th>Country</th></tr><tr><td><div id="name">Sachin</div></td><td><div id="country">India</div></td></tr></table><div class="central"><button type="button">Update Details </button></body></html>
添加回答
举报
0/150
提交
取消