且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在XAMPP上启用跨域资源共享?

更新时间:2023-02-24 13:59:37

您必须在lookup_update.php的开始处编写以下代码

You have to write below code at the beginning of your lookup_update.php

header('Access-Control-Allow-Origin: *');
header('Content-type: application/json');

您只能写IP地址而不是*.

Instead of * you can write just Ip address.

OR

首先,您必须检查本地主机或其他服务器上的问题所在.

First you have to check where is problem either on localhost or other server.

尝试以下代码::如果您在警报中获取了一些数据,则问题出在其他服务器上的localhost上.

Try this code : If you getting some data in alert then problem is on localhost else on other server.

$.post( "test.php", function( data ) {
alert( "Data Loaded: " + data );
});