Hi everybody, I want a value calculated in Javascript to be used in PHP b'coz that value will act as an argument for the function defined in PHP. Can I do it If yes, how? One thing I want to tell is that that function is to be defined in PHP only and not i Javascript. In short can I use a value calculated variable of Javascript in PHP. It is urgent... Need help. Thanx VJ
Not directly... JavaScript is client-side and PHP is server-side. The best you would be able to do is calculate whatever you want to calculate in JavaScript, then have the JavaScript trigger the loading of a page with that value within the URL (or a field in a form post) so PHP could evaluate it.
Yes, the way Shawn just mentioned is about the only way to do it. i.e. have the javascript do a window.location = 'file.php?varible=thevar' and have the PHP file use $_GET['varible'] to get it.. Josh
the problem now is that all the values i have calculated in Javascript have to be passed to a Payment gateway file and hence i dont think i wil be able to $_GET them. any other alternative
couldn't you write a wrapper file that would simply retrieve the get or post value and then call or include the necessary file?