I’m using an ajax request to retrun json from a URL.
This is working locally as below :
$.ajax({
url: "http://localhost:8080/updates.json",
type: 'post',
dataType : "json",
success : function(jsonResponse) {
});
},
error: function (err) {
}
});
The url needs to be updated so that it works no matter the na eof server its deployed on.
Can url be replaced with something like : “http://”+getThisHostName()+”:8080/updates.json” ?
Is there a safe way of returning the current hostname path ?
You could do it like this