| View previous topic :: View next topic |
| Author |
Message |
Peter Pitt
Joined: 20 May 2006 Posts: 114 Location: Egypt
|
| How could i send a javascript variable to php? |
| |
|
|
|
|
BigDaddy
Joined: 26 May 2006 Posts: 147
|
| What sort of variable? An object? |
| |
|
|
AmeliaR
Joined: 31 May 2006 Posts: 142
|
you can store it in an HTML input element, then post it to a php script
Say a 'hidden' input element |
| |
|
|
Peter Pitt
Joined: 20 May 2006 Posts: 114 Location: Egypt
|
| So i just post it? |
| |
|
|
AmeliaR
Joined: 31 May 2006 Posts: 142
|
| Yea |
| |
|
|
BigDaddy
Joined: 26 May 2006 Posts: 147
|
http://www.json.org/ is a good protocol for transforming javascript objects into text form.
And then you just post it, either through a form or an XMLHttpRequest |
| |
|
|
Peter Pitt
Joined: 20 May 2006 Posts: 114 Location: Egypt
|
Hmm
So rather than window.open, i have a form submit? |
| |
|
|
BigDaddy
Joined: 26 May 2006 Posts: 147
|
| If you're trying to submit the javascript variable to php and then open a new page, that's probably the best way, yes. |
| |
|
|
Peter Pitt
Joined: 20 May 2006 Posts: 114 Location: Egypt
|
| So is there anyway i can just have a URL for a form rather than a submit button? |
| |
|
|
BigDaddy
Joined: 26 May 2006 Posts: 147
|
Sure
There's a submit() method for forms. |
| |
|
|
| Page 1 of 2 |
Goto page 1, 2 Next |
|