Jquery Mobile - refresh form on active page
<p>Could anyone help me with a confusing Jquery issue.</p>

<p>I want to send details to a php mailer script - which will respond with sent or failed according to its success.  I use the following script - </p>

<pre><code>          data_html = "name="+ names + "&amp;emailA=" + emails +"&amp;compr=" +prize+"&amp;telno=" +phone+"&amp;winner=" +win  ;


          $.ajax({type: 'POST',url: 'sendMailPgK.php',  data: data_html,
                  success: function(msg){
                      if (msg.indexOf("sent") &gt;= 0){
                        resetPKForm();  
                      $.mobile.changePage( $("#thanksPage"), "slide", true, true);
                     $('#paypForm').submit().delay(1200);

                      }
                      if (msg.indexOf("failed") &gt;= 0){
                          resetPKForm();
                      $.mobile.changePage( $("#sorryPage"), "slide", true, true);

                      }
                  }
                          })
</code></pre>

<p>My issue is that - if the server containing the php file is down for whatever reason - the sript acts as though it has received a sent reply anyway - which is very confusing!</p>

<p>Any suggestions would be great</p>

<p>cheers
Paul</p>
