How do I pass a javascript variable as a get/post parameter to a .php?
-
I Have <script> var=20 </script> I want to do something like <form action=search.php?var>
-
Answer:
Ajax! But I do not think it is exactly what you want!
Share knowldge, lets be friends. at Yahoo! Answers Visit the source
Other answers
This is one way: <script> var myValue = "New Value"; var myForm = document.getElementById("myForm"); var myElement = document.getElementById("myElement"); myElement.value = myValue; myForm.submit(); </script> <form id="myForm" etc. <input id="myElement" type="hidden" value="not set yet" /> etc. I'm sure there are other ways, but I know this way works.
Unca Alby
Related Q & A:
- How can I get a good deal at a luxury resort?Best solution by lastminute.com
- How do I get a nice face next to my name instead of a sillhouette?Best solution by Yahoo! Answers
- How can I burn a .rmvb file onto a DVD for viewing on a regular DVD player?Best solution by Yahoo! Answers
- How can I get a clinic job as a nurse right out of college?Best solution by Yahoo! Answers
- How can I get a text alert when I get an email?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.