title: Ajax Post request to a Jax-rs service
body: <p>I'm trying to do a simple post request from a browser and <code>415 Unsupported Media</code> is show in browser's console, in the console it says too that the <code>Type</code>is <code>text/html</code>, maybe I'm mising something stupid here but seriously I'm doing post request from an android client and everything is find with the server side, so i guess (since I'm not familiar with js) it's a javascript problem I'm having here, here are the portions of interest of the code:</p>
  
  <p>ajax (this function is called <code>send</code> and it does some things before to create the json, that part it's ok and tested, the json is being genereated successfully):</p>
  
  <pre><code>$.ajax({
          url: 'webresources/serverConfig/save/',
          type: 'post',
          dataType:'json',
          data: jsonObj
      });
  </code></pre>
  
  <p>how i call the javascript in the HTML form:</p>
  
  <pre><code>&lt;form action="javascript:send()"  method="post"&gt;
  </code></pre>
  
  <p>JAX-rs service:</p>
  
  <pre><code>@Path("serverConfig/")
  public class ConfigurationSaverService {
  
  @POST
      @Path("save/")
      @Consumes(MediaType.APPLICATION_JSON)
      public void save(Configuration configuration){
      //config stuffs here.
  }
  </code></pre>
  
  <p><code>Edit:</code> due to @adrianplattner's answer, it's important to say that I'm using <code>glassfish 4.0</code>, so i didn't need to add jersey's dependencies, I also try <code>glashfish 3.1</code> and still get the same HTTP error.</p>
  
  <p><code>EDIT 2:</code> Header:</p>
  
  <pre><code> headers: { 
      'Accept': 'application/json',
      'Content-Type': 'application/json' 
  },
  </code></pre>