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.