title: Posting data to cross domain and handling the response
body: <p>I am new to Jquery, I am trying to post some data to cross domain and I want to handle the response which is a complete HTML page</p>
  
  <p>I am using the following code</p>
  
  <pre><code>$.ajax({
  
      url: "http://www.somehost.com/abc/xyz.php",
      type: "post",
      data:{page: "123", calltype: "1"},
      // crossDomain: true,  I tried with using it as well
      dataType:'html',
      success: function(response, textStatus, jqXHR){
          console.log(response);
      },
      error: function(jqXHR, textStatus, errorThrown){
          console.log("The following error occured: "+textStatus);
          console.log(jqXHR);
      },
  });
  </code></pre>
  
  <p>When I use <code>dataType:'html'</code>, <code>error</code> function fired and firebug log with </p>
  
  <pre><code>POST http://www.somehost.com/abc/xyz.php 302 Moved Temporarily 231ms
  The following error occured: error
  Object { readyState=0, status=0, statusText="error"}
  </code></pre>
  
  <p>but when I use <code>dataType:'jsonp'</code>, again <code>error</code> function fired but this time HTML response loaded successfully but there is some parse error which I am not able to understand and firebug log with </p>
  
  <p><strong>FIRE BUG</strong></p>
  
  <pre><code>The following error occured: parsererror
  Object { readyState=4, status=200, statusText="success"}
  SyntaxError: syntax error       
          &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//E
  </code></pre>
  
  <p>and html response is correct(because I clicked on the link in firebug it is openning) which is something like this</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "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;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;link rel="stylesheet" type="text/css" href="css/style.css"/&gt;
  &lt;title&gt;Welcome&lt;/title&gt;
  .
  .
  .
  </code></pre>
  
  <p>I want to do some work on this html page response, I dont know what I am doing wrong please help me.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>After checking @alkis reply, I am trying to use this proxy page on my localhost right now, the server which I am requesting requires some kind of login, which work fines when I call cross domain ajax call (which loads the page fine but there is some kind of parse error I mentioned above), but I dont know it is not responding the exact same page when I use proxy, any help ?</p>