Jquery 弹簧&x2B;泽西岛+;访问控制允许在AppFog上部署源站
我不知道为什么在使用Ajax对JQuery进行服务器调用时抛出此错误 我的服务器代码是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",
@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://....... 访问控制不允许原点允许原点。