Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The PHP in the iFrame should post unique sessionID in the database with result. In the meanwhile you can do an Ajax call to check the database if the mail is sent.</p> <p>So we got 3 files</p> <ul> <li>Your form (like index.html)</li> <li>Your Mailer in iframe (like sendMail.php)</li> <li>Your status checker (like getStatus.php)</li> </ul> <p>Here we go..</p> <p>Your IFRAME Mailer:</p> <pre><code>&lt;?php session_start(); $_SESSION['mailsender'] = mt_rand(); // this is ur iframe mailer // here your mail send stuff ..... // if mail is sent mysql_query("INSERT INTO mailsender (mailid, result) VALUES ('".$_SESSION['mailsender']."', 'successfull')"); // if mail fails mysql_query("INSERT INTO mailsender (mailid, result) VALUES ('".$_SESSION['mailsender']."', 'failed')"); ?&gt; </code></pre> <p>getStatus.PHP :</p> <pre><code>&lt;?php session_start(); // check status and give JSON back // getStatus.php - we be called from front-end $query = mysql_query("SELECT * FROM mailsender WHERE mailid = '".$_SESSION['mailsender']."'"); $result = "Pending"; if (mysql_num_rows($query) &gt; 0) { while ($row = mysql_fetch_array($query)) { $result = $rij['result']; } } echo json_encode(array("result"=&gt;$result)); ?&gt; </code></pre> <p>Your Front-end like Index.html:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;!-- include jQuery --&gt; &lt;script&gt; $(document).ready(function(){ checkMailStatus = function() { $.ajax({ url: 'getStatus.php', dataType: 'JSON', success: function(data) { if (data['result'] == "successfull") { // do successfull stuff here // also clear the interval } if (data['result'] == "failed") { // do failed stuff here } if (data['result'] == "pending") { // still trying to send // do stuff here while sending (like loading.gif) } } }) } $(".sendmailbutton").click(function(){ setInterval(function(){ checkMailStatus(); }, 800) }) }) &lt;/script&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload