Jump to content

Passing parameters using Java Script to another PHP and open it


darantes

Recommended Posts

Hi all !

Let me see if anyone can help me with that. I spent hours and hours on this, but in the end, I abandoned cause I really think this has no solution.

The whole thing is:
* I have a login page;
* I enter my username and password and click Login;
* An ajax request queries the database to validate my login;
* I receive the request response and, at this point, I deny the login or I grant it.
* When granting the login, I call the next page and everything is ok, [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]unless if you want to send some variables to the next page.[!--colorc--][/span][!--/colorc--]

[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]This is my blocking point[!--colorc--][/span][!--/colorc--]. The next page that is called when the login is well done I will need the user name, id, email, etc...

My question is: How to send variables through POST or GET without submiting a form and thus reloading the page ?

I tried to make another Ajax request to my next page, but it definitely makes no sense ! Also I thought using cookies would easily solve my problem, but I don't like the idea regarding that many users have cookies disabled on their browsers.

I know it is possible to do because I see Gmail working like that ! But even tracking its login page java script source code, I didn't find out how they do it.

One can say it is worthless because all this work will only prevent the page from reloading, and instead I could submit the form, but here my aim is to turn the pages every time more dynamic using new technologies and surely, giving the web a more beautiful look ;)

Anyone have any idea ?
Link to comment
Share on other sites

Have you tried domain.com/page.php?Var1=value&Var2=value2? This will send the variables as a get request. Also, you always can use sessions (in php) to store the data from one page to another.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.