I am running an asp.net website with an ajax call. However, I can't get the call to work when in a subfolder.
What I want to have happen is one place to define the ajax call:
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 + '
' + errorMessage); }
});
}
The problem arises when in the /admin folder ... it can't find my services folder in the root. Yes, I could use /Services/wsvc_Security.asmx/LogOut ... except that on the server I have 2 application paths: /LiveVersion and /TestVersion. I don't want to have to change code when deploying to different environments.
Is there a way to do in javascript what I can do in .Net? meaning: ~/Services/wsvc_Security.asmx/LogOut
Where ~/ gets me the root of the application