Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 弹簧&x2B;泽西岛+;访问控制允许在AppFog上部署源站_Jquery_Spring_Servlets_Jersey - Fatal编程技术网

Jquery 弹簧&x2B;泽西岛+;访问控制允许在AppFog上部署源站

Jquery 弹簧&x2B;泽西岛+;访问控制允许在AppFog上部署源站,jquery,spring,servlets,jersey,Jquery,Spring,Servlets,Jersey,我不知道为什么在使用Ajax对JQuery进行服务器调用时抛出此错误 我的服务器代码是 @POST @Path("/update") @Produces({ "application/json "}) public Response update(String json) { ...... ResponseBuilder builder = Response.ok("test"); builder.header("Access-Control-Allow-Origin",

我不知道为什么在使用Ajax对JQuery进行服务器调用时抛出此错误

我的服务器代码是

@POST
@Path("/update")
@Produces({ "application/json "})
public Response update(String json) {
    ......
    ResponseBuilder builder = Response.ok("test");
    builder.header("Access-Control-Allow-Origin", "*");
    builder.header("Access-Control-Allow-Headers", "*");
    return builder.build();
我的Jquery代码是

var URL = "http://........";


$.ajax
({
    type: "POST",
    //the url where you want to sent the userName and password to
    url: URL,
    dataType: 'json',

    success: function (data) {
    alert("ok"); 
    }
});

注意:相同的代码在Google App Engine上运行良好….

在Firefox、Safari或IE中尝试。我遇到了相同的问题。

在Firefox、Safari或IE中尝试。我也遇到了相同的问题。

如果问题很明显,很抱歉-抛出了什么错误?无法加载相同的XMLHttpRequesthttp://....... Access-Control-Allow-Origin不允许使用Origin。很抱歉,这应该是显而易见的,但是-抛出了什么错误?无法加载相同的XMLHttpRequesthttp://....... 访问控制不允许原点允许原点。