eRott Posted April 13, 2009 Share Posted April 13, 2009 Hey there, Before I begin, I would like to mention that there is some PHP mixed in here, but its most definitely a JavaScript question. Moving on. I am looking for a bit of direction with something I am trying to do using ThickBox. I am unsure if any of you whom are reading this are aware of what that is, so here is a [link] if it helps. Okay, so to start off, here is my basic link element which is required to bring up the ThickBox modal window. (Pretty irrelevant to the question I suppose). <?php echo '<a href="confirm.php?bid='.$row['id'].'&placeValuesBeforeTB_=savedValues&TB_iframe=true&height=40&width=400&modal=true" title="Delete Confirmation" class="thickbox">'; ?> Now, here is the page I have displaying in that iFramed ThickBox window: <?php echo '<form method="post">'; echo '<div style="font-family: Tahoma, sans-serif; font-size: 14px; text-align: center;">'; echo 'Are you sure you want to delete this block?'; echo '<input type="submit" name="yes" id="yes" value="Yes" />'; echo '<input type="submit" name="no" id="no" value="No" onclick="self.parent.tb_remove();" /> echo '</div>'; echo '</form>'; include '../db.php'; if(isset($_POST['yes'])) { $bid = $_GET['bid']; $query = "DELETE FROM blocks WHERE id = '$bid'"; mysql_query($query) or die('Error: Block could not be deleted!'); echo "<script>self.parent.tb_remove();</script>"; } ?> Take special note of the bit of Javascript I have echoed out after the user has clicked the "Yes" form button. This is the function which closes the ThickBox modal window. <script>self.parent.tb_remove();</script> What I am looking to do, is refresh the parent page (the page where the ThickBox was opened from) before closing the ThickBox window. Any advice would be greatly appreciated. Take care. Quote Link to comment Share on other sites More sharing options...
eRott Posted April 13, 2009 Author Share Posted April 13, 2009 Figured it out. For any potential future viewers, create a function on the page where the thickbox was called from. <script> function tb_closeRefresh(){ window.location.reload(true); } </script> Then just call your function inside the tb_remove() function of thickbox.js. tb_closeRefresh(); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.