html+ js 代码:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>jsonp-test</title> </head> <body> <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script> <script type="text/javascript"> var url = 'http://app.yatibang.com/update/getUpdateInfo?getFlag=www'; $.ajax({ url: url, type: 'GET', dataType: 'JSONP',//here jsonp:"callback", jsonpCallback:"success_jsonpCallback", success: function (data) { alert(data.versionCode); } }); </script> </body> </html>
php代码: