我第一次寫的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>
新手問題:ajax與json如何從服務器上獲取JSON數據?
Helenr
2018-09-11 14:10:39