Sending a JSON thru jQuery POST is not hitting the REST service
===

I looked up similar errors on the forum, but seems not be working still and I am getting
 `Status Code: HTTP/1.1 415 Unsupported Media Type`

I am sending this jQuery:

    $("#btnInsertCustomer").click(function (){
    	     	var myObj = {name: "Bill Adama", address:"Vancouver Canada"};
        		var jsondata = JSON.stringify(myObj);
    	     	
    	        $.ajax({
    	            type: "POST",
    	            url: "http://localhost:8081/RestDemo/services/customers/add",
    	            contentType: "application/json",
    	            dataType: "json",
    	            data: jsondata,
    	            success: function (resp, status, xhr) {
    	            	var msg = "Name: " + resp.name + ", Address: " + resp.address;
    	                alert(msg);
    	                $("#successPost").html(msg  + " - STATUS: " + xhr.status + " " + xhr.statusText);
    	                
    	            },
    	            error: function(resp, status, xhr){  
    		         	alert("Error: " + resp.e); 
    		         	$("#errorPost").html("Error: " + resp.e  + " - STATUS: " + xhr.status + " " + xhr.statusText);
    		         	
    		       	} 
    	        });
    	     });
 
to this following resource:

    @POST
    	@Path("/add")
    	@Produces("application/json")
    	@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    	public String addCustomer(Customer customer) {
    		 //insert 
    		 int id = customerMap.size();
    		 customer.setId(id);
    		 customerMap.put(id, customer);
    		 //get inserted
    		 Customer result = customerMap.get(id);
    		 
    		 return  "{\"name\": \" " + result.getName() + " \", \"address\": \"" + result.getAddress() + "\"}";
    }      

it is not hitting the serivce and in giving me the error. I can't understand if the error is in formatting the sent data on jQuery side (which seem to be ok) or in the service receiver.

Any help is appreciated, Thanks!