So while i load the page there is a javascript pop up box with two button ( confirmation box ) If user click on OK i have to run a php code if user clicks on cancel i have to run another php.
I taught thats the easiest way to do this is that if i create a variable in php and i modify it in js, and after this i just do an if/else method:
<?php
....
$atir=-1
print '<script type="text/javascript">
var retVal = confirm("Quetion?")
if(retVal==true){
$atir=1
}
else {
$atir=0
}
</script>';
if($atir==1){}
else if($atir==0){}
...?>
I've read that ajax is can be do sg like this, but ajax is after that the page loaded, and i want to do this while the page is loading, and thats while I think this is possible.