title: why Ajax get Request failed
body: <p>The response of my request is a java script code. When I put the url in browser, I can see the whole generated java script code on the page. Format of url passed to $.ajax is as below:</p>
  
  <pre><code>http://localhost:8080/vi-api/viapi?action=tag&amp;projectId=45&amp;tagId=345
  </code></pre>
  
  <p>When I put the above URL I can see the request is successful. Now, I am using below Ajax request for this url using jQuery.</p>
  
  <pre><code>   var finalUrl = "http://localhost:8080/vi-api/viapi?action=tag&amp;projectId=45&amp;tagId=345";
     var req = $.ajax({
               type:"GET",
               url:finalUrl,
               type:"script",
               data:"",
               success: function(html){
                  alert('Requese sucessful.');
                },
              complete:function(jqXHR, textStatus) {
                  alert("request complete "+textStatus);
               },
              error: function(xhr, textStatus, errorThrown){
                  alert('request failed-&gt;'+textStatus);
              }             
             });  
  </code></pre>
  
  <p>Question 1:This gives the alert "request failed error'. Why this is so ? </p>
  
  <p>Question 2:Is there any way to return success/failure code in above process?</p>