Jump to content

[SOLVED] ThickBox, iFramed Content and Page Reloads


eRott

Recommended Posts

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.

Link to comment
Share on other sites

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();

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.