Note that there are some explanatory texts on larger screens.

plurals
  1. POget a form field value from fancybox iframe and return it to beforeClose function
    primarykey
    data
    text
    <p>I am using jquery fancybox 2 to load an iframe form. The form submits and writes the data to the database then closes the fancybox. So that part of its all good. However i want to retrieve a hidden field value from the iframe form. This value will then hide the corresponding id on the parent page. I try to get the hidden field value using the beforeClose option. However i cannot get the hidden field value.</p> <p>The hidden field has an pageload. fancybox code:</p> <pre><code>$(".various").fancybox({ maxWidth : 800, maxHeight : 700, fitToView : false, width : '70%', height : '90%', autoSize : false, closeClick : false, openEffect : 'fade', beforeClose : function(){ var pageload = $('#pageload').val(); console.log('var = ' + pageload); }, afterClose : function(){ if(pageload != 0){ $('#'+pageload).slideUp('slow'); } else { window.location.reload(true); } } }); </code></pre> <p>and the fancybox is triggered by :</p> <pre><code>&lt;a href="editcategory.php&amp;pageload=&lt;?php echo $sub_id; ?&gt;" class='various' data-fancybox-type='iframe'&gt;LINK&lt;/a&gt; </code></pre> <p>When the iframe popsup there is :</p> <pre><code>&lt;input type="hidden" value="&lt;?php echo $_GET['pageload']; ?&gt;" id="pageload" name="pageload" /&gt; </code></pre> <p>And all i need to do is return the pageload value back to the afterClose function. I have tried using the afterLoad function to get value, the beforeClose function but none of them seem t give me an answer apart from null. This will then 'slideup' that id and then clear it in the index page.</p> <p>If the value = 0 it will do a page reload.</p> <p>I have searched all day for an answer but they all seem very complex for probably a simple 2 line function.</p>
    singulars
    1. This table or related slice is empty.
    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