Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP wont echo into Iframe in Webkit
    primarykey
    data
    text
    <p>hey guys I'm having a problem with an upload form I've made. It works in Firefox and IE but it wont work with Safari and Chrome so I assume it's a webkit problem. First I run the php form and change the target to an iframe. Then once it's finished uploading I get PHP to echo a div iwth a statement true/false back into the iframe. The problem i'm having is that PHP isn't echoing the statement into the iframe. here's the code i've got:</p> <p>in the php:</p> <pre><code> //do all the appropriate checks etc and if it's uploaded do the following if ($success == true) { echo '&lt;div id="result"&gt;success&lt;/div&gt;'; } else { echo '&lt;div id="result"&gt;error&lt;/div&gt;'; } </code></pre> <p>then in my javascript I do a few checks to see if the forms filled out etc and then if all is well I call submit() first and then I call iframeCheck()</p> <pre><code> function submit() { //change the target of the upload form to upload to the iframe. $('#contactForm').attr('target','uploadIframe'); //submit the iframe $('#contactForm').submit(); //fade in the sending message $('#sendingMessage').fadeIn(200); } function iframeCheck() { //get the contents of iframe var elem = $('#uploadIframe').contents().find('div#result'); var result = elem.html(); //if there's nothing in it, upload hasn't finished... if ( elem.length &lt;= 0) { //check it again in 2" clearTimeout(timer); var timer = setTimeout(iframeCheck, 2000); } else if (result =='success'){ //if it contains a success message, display the success message $('#sendingMessage').fadeOut(200); $('#successMessage').fadeIn(500); inputButton.removeAttr('disabled'); } else { if (result == 'error') { //otherwise display the error message $('#sendingMessage').fadeOut(200); $('#failureMessage').fadeIn(500); inputButton.removeAttr('disabled'); } } } </code></pre> <p>It works fine in ff and IE but as i said chrome and safari wont echo into the iframe. Thanks for your help folks!</p>
    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. 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