Reputation: 1399
I am validating a login form using ajax call. It is working great when you enter the wrong information. But if you enter the right credentials nothing happens. I am confused what to do? sample code:
$.ajax({
type: 'POST',
url: URL +'/foo/',
data: {'uname': name, 'password':pass},
success: function(data) {
if (data["success"] === "false") {
//show some message
$("#password").val("");
}
else {
// here i want to redirect to some url say, /bar/
I am confused how to do it.
},
dataType: "json",
});
return false
Upvotes: 1
Views: 2827
Reputation: 15835
you can use javascript.
location.href="new url";
it will take you to the new url
var querystringParam="sample";
var tempUrl="http://www.test.com?" + "variablettopass=" + querystringParam
location.href=tempUrl;
if you have more than one append to query string...
if you want your server name from browser window use this code
window.location.hostname
but if you do location.href // it will take care...i just gave you for info
Upvotes: 3