Operating an asp.net website with an ajax call has presented a challenge for me when in a subfolder.
I aim to streamline the ajax call process by defining it in one place:
function LogOut() {
$.ajax({
type: "POST",
url: "Services/wsvc_Security.asmx/LogOut",
contentType: "application/json; charset=utf-8",
async: true,
success: function (data) { console.log("done"); },
error: function (request, errorType, errorMessage) { console.log('ajax error - ' + request + '\n' + errorMessage); }
});
}
The issue arises when within the /admin folder...the services folder can't be located in the root. Even though I could use /Services/wsvc_Security.asmx/LogOut ...but on the server there are 2 application paths: /LiveVersion and /TestVersion. I prefer not to constantly alter code during deployment to different environments.
Is there a way in javascript to achieve what I can do in .Net? Meaning: ~/Services/wsvc_Security.asmx/LogOut
Where ~/ takes me to the root of the application