jquery - How to redirect on particular url in ajax -
i validating login form using ajax call. working great when enter wrong information. if enter right credentials nothing happens. confused do? sample code:
$.ajax({ type: 'post', url: url +'/foo/', data: {'uname': name, 'password':pass}, success: function(data) { if (data["success"] === "false") { //show message $("#password").val(""); } else { // here want redirect url say, /bar/ confused how it. }, datatype: "json", }); return false
you can use javascript.
location.href="new url";
it take new url
var querystringparam="sample"; var tempurl="http://www.test.com?" + "variablettopass=" + querystringparam location.href=tempurl;
if have more 1 append query string...
if want server name browser window use code
window.location.hostname
but if location.href // take care...i gave info
Comments
Post a Comment