0

I am new to serious javascript programming, Working my way up in the world to HTML5 and I have gone round and round.

The address works in a browser so I know its there, but when I go to debug I get a 404 error from the following javascript code

function loadTotalLabels() {
    //get json data
    var jsonData = JSON.stringify({ "args": "" });
    $.ajax({
        type: "POST",
        async: false,
        cache: false,
        url:"http://localhost:52594/Service1.svc/getTest",
        data: jsonData,
        contentType: "application/json; charset=utf-8",
        dataType: "json", // dataType is json format
        success: onTotalsSuccess_,
        error: OnErrorCall_
    });
}

When I look at the error it tells me that it can not find Service1.svc/getTest

If I remove the Port number and put the project name in (http://localhost/prsTest/service1.svc/getTest which is running on my local IIS), it works fine (throws a Network error, but one error at a time).

So, can anyone tell me how to get the Javascript to use the "localhost + port number"? I have tried location.host and that did not work. Or tell me where to look, as I have not found anything on this item.

рüффп
  • 5,172
  • 34
  • 67
  • 113
Daryl
  • 28
  • 8
  • 1
    http://stackoverflow.com/questions/1768385/is-it-possible-to-specify-a-port-in-a-ajax-call Might be helpful – qwerty_igor Jun 09 '15 at 23:33
  • Thank you, it is annoying, but if that is the way it has to be. I will move it to the local IIS server, and just run it off of there. Thank you qwerty_igor. – Daryl Jun 12 '15 at 20:52

0 Answers0