title: JQuery Ajax Submit Form - Getting response
body: <p>I am posting a form using Jquery Ajax...this is the code:</p>
  
  <pre><code>$( document ).ready(function() {
  
  
              //callback handler for form submit
  $("#myform").submit(function(e)
  {
      var postData = $(this).serializeArray();
      var formURL = $(this).attr("action");
  
      $.ajax(
      {
          url : formURL,
          type: "POST",
          crossDomain: true,
          data : postData,
          success:function(data, textStatus, jqXHR) 
          {
              //data: return data from server
              alert('it worked');
              alert(this.data + "," + this.url);
          },
          error: function(jqXHR, textStatus, errorThrown) 
          {
              //if fails   
              alert('it didnt work');   
          }
      });
      e.preventDefault(); //STOP default action
      e.unbind();
  });
  
  $("#myform").submit(); //Submit  the FORM
  
  });
  </code></pre>
  
  <p>This works fine and onsucess I've added this:</p>
  
  <p>alert(this.data + "," + this.url);</p>
  
  <p>And it's giving me the posted data and url.</p>
  
  <p>My problem is that the api that it's submitting to returns data like this after the form is submitted:</p>
  
  <pre><code>&lt;response&gt;
  &lt;result&gt;12&lt;/result&gt;
  &lt;message&gt;Successful.&lt;/message&gt;
  &lt;/response&gt;
  </code></pre>
  
  <p>What I want to do is to be able to get that response.</p>
  
  <p>How can I get this info?</p>