I have not used php before and I do not know how to add a pop-up window there after successful sending, since what pops up after sending is: echo (‘The email has been successfully sent!’);, and I want to make this pop-up written in js, is it possible to somehow turn to pop-up in php.
I haven’t tried anything since I don’t know php.
2
Answers
PHP works on the server and is not interpreted in the browser. What you want to do is to have PHP send back javascript code which will be interpreted by the browser and does whatever you want (open a pop-up).
So if you call a PHP script in simple POST or GET method, then your browser will actually be served a new page from PHP. And you can write whatever you want in the PHP result, so this should be a mixture of html and javascript:
In case you work with AJAX calls you have to make sure that your AJAX implementation (you probably use javascript and some framework for it) actually interprets javascript code when receiving the result.
I’m combining javascript and PHP bootstrap like this:
bootstrap html:
Javascript
for example sending to signup form
PHP
after processing, add this for success/failed message
change success to true or false to perform success or failed.
This is work for me.