I call a method from Ajax. The method returns string. After the method finishes, I need to redirect the url.
success: function (data) {
window.location.href = data;
}
So, in the beginning the url is localhost:1111/Login/Index and everything works fine if data != “”.
But, if data = “”, then I want window.location.href to be localhost:1111/. Now, window.location.href is localhost:1111/Login. How to do this?
You can create the URL as follows: