I’m looking to redirect users to a new page once the form has been posted. However, I want to parse a variable to that new page as well. The variable is being returned by the PHP file.
$("#ajaxquery").live( "click" , function(){
var formdata = $(this).serialize();
$.post( "includes/generate.php", formdata, function( data ) {
$(".success").html(data);
});
return false;
});
At the moment I can get the returned data from the PHP file to display on the .success div correctly but I can’t get it to work using a redirect. This is what I’m trying:
window.location = "../download.php?site=" + html(data);
Also – is parsing the data in the URL the best approach for this? The data is just a unique ID which is used in download.php.
window.location = "../download.php?site="+data;
EDIT:
I tried the below code and it’s working now but there’s still another problem.
It’s adding a double space between the = and the data for some reason? I can’t see anything in the code that would cause this.
/download.php?site= 4e0928de075538c593fbdabb0c5ef2c3
For the problem with the spaces:
This will strip out any opening spaces; I’m not sure where they’re coming from.