re1man
re1man

Reputation: 2367

passing two values to php page in url via jquery

I have this function after an ajax post.

success: function(){

    window.location = 'morefive.php?document=' + path;
    }

I wanted to know how I could pass two variables, I have been having trouble figuring this out for jquery. It would be the equivalent of morefive.php?document=path&url=link the variable link being a url (would it have to be encoded?)

Upvotes: 1

Views: 919

Answers (2)

Sergi Ramón
Sergi Ramón

Reputation: 1744

If i understand your question, you need to use encodeURIComponent() like this:

window.location = 'morefive.php?document=' + path + '&url=' + encodeURIComponent(link);

Upvotes: 1

Marc B
Marc B

Reputation: 360572

window.location = 'movefive.php?document=' + path + '&url=' + linkvar

Nothing says you can't concatenate multiple strings/variables together. Just separate each var=value pair with a & character.

Upvotes: 0

Related Questions