title: jQuery client for REST webservice with jersey
body: <p>I am new in jQuery and I'm trying to develop a client for my web service. I've tried something simple, just for testing, but still it doesn't work, although it seems ok to me.</p>
  
  <p>I have the jQuery library in my tomee/webapp folder, along with my html and javascript files. If I write some non-jQuery code in my javascript file, it works.</p>
  
  <p>I have the following code:</p>
  
  <p>index.html</p>
  
  <pre><code>&lt;!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
      &lt;head&gt;
          &lt;title&gt;&lt;/title&gt;
          &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript" src="client.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;input type="button" id="getAllButton" value="Get all books" onclick="return getAllBooks()"/&gt;
          &lt;div id="messageBox"&gt;&lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>client.js</p>
  
  <pre><code>function getAllBooks() {
      $.ajax({
          dataType: 'application/xml',
          type: 'GET',
          url: rootURL + '/books',
          success: function (data) {
              alert(1);
          },
          error: function (data) {
              alert(2);
          }
      });
  }
  </code></pre>
  
  <p>The problem is that no alert will appear. If a write pure javascript (I mean without jQuery), alerts will do appear.</p>
  
  <p>Why do alerts not appear? Any advice?</p>
  
  <p>Thank you!</p>
  
  <p>Sorin</p>