title: Ajax always return error when use with jsonp
body: <p>I have spent all my day in understanding how jsonp works. I have tried many solutions available over internet but none of them is working for me. following is the code, I am accessing a third party rest API. First I used </p>
  
  <blockquote>
    <p>dataType : "Json"</p>
  </blockquote>
  
  <p>but it was giving me cross domain blockage error. I changed it to use </p>
  
  <blockquote>
    <p>dataType : "jsonp"</p>
  </blockquote>
  
  <p>but now response always ends in error method with </p>
  
  <blockquote>
    <p>textStatus ="parseerror" and jqXHR ="call back was not called."</p>
  </blockquote>
  
  <p>following is my sample code, please have a look</p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
      $(document).ready(function () {
          alert("document is ready");
          window.test = function (data) {
              debugger;
          };
  
          $("#btnAuth").click(function () {
              $.ajax({
                  url: "https://partner3.powerschool.com",
                  dataType: "jsonp",
                  jsonpCallback: 'test',
                  beforeSend: function (req) {
                                     req.setRequestHeader("Authorization", "Basic " + "abc" + ":" + "xyz");
                      req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=UTF-8');
                  },
                  success: function (data) {
                      debugger
                      alert("success"); alert(data);
                  },
                  error: function (data, textStatus, jqXHR) {
                      debugger
                      alert(JSON.stringify(data));
                  }
  
              });
          });
      });
  &lt;/script&gt;
  </code></pre>