發起一個jsonp請求
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <title>test</title> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $.ajax({ type: "get", async: false, url: "http://encounter.christmas023.space/json.php?name=mavis&age=18", dataType: "jsonp", jsonp: "callback",//傳遞給請求處理程序或頁面的,用以獲得jsonp回調函數名的參數名(一般默認為:callback) jsonpCallback:"message",//自定義的jsonp回調函數名稱,默認為jQuery自動生成的隨機函數名,也可以寫"?",jQuery會自動為你處理數據 success: function(json){ alert('你的名字:' + json.name + ' 年齡: ' + json.age); }, error: function(){ alert('fail'); } }); }); </script> </head> <body> </body> </html>
http://www.jb51.net/article/103960.htm jsonp返回數據樣式,請求方法
https://blog.csdn.net/a491857321/article/details/52807532
jsonp實現json數據跨域訪問
https://blog.csdn.net/xiangnan129/article/details/54409089 jsonp后端應該如何返回數據,前端應該如何請求
https://blog.csdn.net/kejmln/article/details/51350777 jsonp后端應該如何返回數據,前端應該如何請求
https://blog.csdn.net/liuqing_1/article/details/53858447?utm_source=itdadao&utm_medium=referral jsonp跨域請求
https://segmentfault.com/a/1190000011145364 前端跨域解決方案(全)