title: connecting javascript to a Web API
body: <p>I am new to the web development world and I would like to be able to connect an HTML page to a web api through . and I was really not successful in this.</p>
  
  <p>I followed this tutorial to be able to make this connection : <a href="http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api" rel="nofollow noreferrer">http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api</a></p>
  
  <p>All I need is to send some inputs from an HTML page to a web api that takes these parameters and returns an object</p>
  
  <p>I am using this code </p>
  
  <pre><code>$.getJSON("api/GeneratorController/setparameters/"+firstparameter+"/"+secondparameter+"/"+thirdparameter+"/"+fourthparameter+"/"+fifthparameter+"/"+sixthparameter,
  function (data) {
     alert(data); //never comes here
  }).fail(function (jqXHR, textStatus, err) {
     alert("All checks are correct, image was not generated. jqXHR = " + jqXHR.valueOf() + " textStatus=" + textStatus + " Error" + err);
  });
  </code></pre>
  
  <p>it always goes into the fail portion , I attached the alert message that comes out of it</p>
  
  <p><img src="https://i.stack.imgur.com/KPhbi.png" alt="Error Message"></p>
  
  <p>Any Reason why it is doing this ?</p>
  
  <p>@smartmeta (I changed the typo , thanks) I followed your advice and here is the output of the alert (as expected , values that I have inserted are displayed):
  <img src="https://i.stack.imgur.com/y8sRa.png" alt="enter image description here"></p>