發起一個jsonp請求javascript
<!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返回數據樣式,請求方法php
https://blog.csdn.net/a491857321/article/details/52807532
jsonp實現json數據跨域訪問html
https://blog.csdn.net/xiangnan129/article/details/54409089 jsonp後端應該如何返回數據,前端應該如何請求前端
https://blog.csdn.net/kejmln/article/details/51350777 jsonp後端應該如何返回數據,前端應該如何請求java
https://blog.csdn.net/liuqing_1/article/details/53858447?utm_source=itdadao&utm_medium=referral jsonp跨域請求jquery
http://www.javashuo.com/article/p-gjnaksry-em.html 前端跨域解決方案(全)ajax