下載的源碼中XMLHttpRequestjQueryJsonp.html腳本中get請求的端口號為8000,改為8080就可以實現了。 同樣需要測試POST返回結果的同學,請將POST請求的端口號也改一下,并在serverjsonp.php中加入頭信息
header("Access-Control-Allow-Origin:*");(必要)
header("Access-Control-Allow-Methods:POST,GET");(非必要)
header("Access-Control-Allow-Origin:*");(必要)
header("Access-Control-Allow-Methods:POST,GET");(非必要)
2017-05-27