I want to call a JavaScript function through PHP and store the returned value in a PHP variable. How to do this?
3
-
What function? What exactly are you doing? This is possible, but there may be a better way since JavaScript is client-side and PHP is server-side.John Kugelman– John Kugelman2009-10-31 06:09:47 +00:00Commented Oct 31, 2009 at 6:09
-
If you post what you're trying to do, we can help you find a solution.James Skidmore– James Skidmore2009-10-31 06:15:16 +00:00Commented Oct 31, 2009 at 6:15
-
exact duplicate of stackoverflow.com/questions/419240/… etc.ax.– ax.2009-10-31 07:08:37 +00:00Commented Oct 31, 2009 at 7:08
Add a comment
|
1 Answer
You can't do that - javascript being a client side technology will execute after your PHP script has already finished so there's no way to do what you are looking to accomplish.
2 Comments
ax.
you can do that - for an example, see stackoverflow.com/questions/419240/…
Marek Karbarz
technically you're not calling a javascript function from PHP, you're just using AJAX to get a PHP page - so it's going javascript -> PHP not PHP -> javascript