Dathremar Posted March 26, 2008 Share Posted March 26, 2008 Once again I need your help guys and girls. I was wandering if there is a way to call a javascript confirm popup within a php code and use that confirmation info (yes/no-> true/false w/e) to continue with the php functions. Example if ($variable == 0) { call confirm; if (yes) { some code; } } Thanks in advance Link to comment https://forums.phpfreaks.com/topic/97989-php-and-javascript/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 26, 2008 Share Posted March 26, 2008 You would need to use Ajax (or some other javascript method of making a http request to the php page to pass the data.) When the javascript/popup executes in the browser, the php code on the page has long since ended as the php code was executed when the page was requested and sent to the browser. Link to comment https://forums.phpfreaks.com/topic/97989-php-and-javascript/#findComment-501359 Share on other sites More sharing options...
Dathremar Posted March 26, 2008 Author Share Posted March 26, 2008 Yeah, you are right ... thx anyway Link to comment https://forums.phpfreaks.com/topic/97989-php-and-javascript/#findComment-501418 Share on other sites More sharing options...
cooldude832 Posted March 26, 2008 Share Posted March 26, 2008 you can do it to write "do this JS function" in php via an echo. But then it will happen as soon as its Outputted So maybe you should try output buffering it until the end on the rendering Link to comment https://forums.phpfreaks.com/topic/97989-php-and-javascript/#findComment-501421 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.