We now have such an html file testjsonp.html under the domain name www.test.com:
Copy the code The code is as follows:
Untitled Page
to your The file path of jquery in the directory:
For example:
Then, you can find another one In the web directory of the domain name, copy the file jsonp.php:
Copy the code
The code is as follows:
$callback = $_GET["callback"];$a = array(
'code'=>'CA1998',
'price'=>'6000',
'tickets '=>20,
'func'=>$callback,
);$result = json_encode($a);echo "flightHandler($result)"; exit;
Put it under this directory. This way you can test it.
Visit testjsonp.html directly in the browser to see the effect.
http://www.bkjia.com/PHPjc/327778.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/327778.html
TechArticle
We now have such an html file testjsonp.html under the domain name www.test.com: Copy the code as follows: !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ww...