JSON crossdomain communication with PHP file and a local javascript file

前端 未结 7 722
孤街浪徒
孤街浪徒 2020-12-21 15:47

I am a JSON newbie, but have good experience in PHP and javascript. The question is simple, and the answer might be simpler. I am having trouble sending data from the PHP fi

相关标签:
7条回答
  • 2020-12-21 16:51

    You could use the same jQuery to make a cross-domain request, Just check the link cross-domain request, they have demo how to implement the cross-domain request...

    In your code, Make sure that the following things are correct,

    • the www.xpal.com output should be in json format
    • if there is any error in your output, jsonp technique doesnt display error (poor error handling).

    • Your json output should be covered with echo $_GET['callback']." ".json_encode($array).")"; as in the mentioned link.

    0 讨论(0)
提交回复
热议问题