Robert Robert - 1 year ago 65
jQuery Question

How do I use jQuery to redirect?

I am using a HTML form to submit to a jQuery validation which then sends information to a PHP processing page through ajax.

Everything works 100% apart from when everything comes back true I can't get the page to redirect to a success page.

The code I have is:

$.post(url,{ username: value_login.val(), firstname: value_firstname.val(), lastname: value_lastname.val(), email: value_email.val(), password: value_password.val()} , function(data) {

if(data == 'success'){

window.location.href = "";
} else {


I'm thinking you can't redirect using the

Answer Source

You forgot the HTTP part:

window.location.href = "";