0

i'm using jquery ,jersey and json. when i try to call a post service i receive this error

Origin null is not allowed by Access-Control-Allow-Origin. undefined * Error: NETWORK_ERR: XMLHttpRequest Exception 101

My client code

$.ajax({url: jurl, type: 'POST', dataType : 'json', headers: {accept:"application/json"},data: inData , cache : false, async : false, contentType : "application/json; charset=utf-8", 

My server Code

@POST
@Path(ReferentialPath.PLAYER_RESOURCE_PATH)
@Consumes(MediaType.APPLICATION_JSON)
public Response createPlayer(CreatePlayerIn cPlayer) {
    try {
        String res = dao.create(player);

        UriBuilder ub = uriInf.getAbsolutePathBuilder();
        URI createdUri = ub.path(res).build();
        return Response.created(createdUri).build();

    } catch (Exception e) {
    }
}

Would anybody tell me what could be the problem

2 Answers2

0

you seem to be trying to POST to another domain.
possible problem wiki
possible solution :you should read this SO question

Community
  • 1
  • 1
austin
  • 1,143
  • 1
  • 12
  • 31
0

Here I guess there must be some firewall between your client and server. HTTP Code 101 represents that your http request be filtered by your net work device. so change your net work and directly connect your server. and try again.

BrookLeet
  • 58
  • 2