I do code verification image in PHP and i show it in another page by calling it.
<img src="getVerifyImage.php"/>
where getVerifyImage.php prepares the image.
I also want to control the code in client side by using java script.
I create a session object which stores the code then i print it inside a hidden field. i read the code by using javascript.
however, the called php complete its run before the image prepared. as a result no session is created. when i try to create my hidden field.
How can i wait my page until getVerifyImage.php’s execution is completed ?
Note : i can not use ajax, because ajax does not work on my server.i do not know why,but it is. i tested several times with other servers. my ajax codes did not work on this server.
You could do that by moving your image generation code to a function, saving the image to disk, and then outputting a regular url to the
<img>tag, from the same PHP file that generates the rest of your markup.HOWEVER, you shouldn’t have your verification code added to your markup. Quoting miki’s comment above: