How to call external webservice using jquery “jsonp”?

前端 未结 5 597
北恋
北恋 2020-12-20 00:51

I had a previous question can jquery ajax call external webservice?


and some good developers answered me to use jsonp, but i don\'t know how to use it, i am tr

5条回答
  •  暖寄归人
    2020-12-20 01:50

    Hezil's code worked for me, but I had to change the server code to this:

    $data = '{"name" : "hello world"}'; echo $_GET['callback'] . '(' . $data . ');';
    

    Note the "callback" instead of "jsoncallback".

提交回复
热议问题