viens
02-18-2007, 02:41 PM
1) Script Title: Ajax Tabs Content script
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm
3) Describe problem:
I call a php script to delete a forum message (in the same tab):
<a href="javascript:linkjax('forum.php?do=delete&mid=<?=$i['id']?>', 'aca', 0)">
Click here to delete message
</a>
I click on link, php script deletes message and shows confirmation:
<?php
echo "Message deleted. Please wait...";
?>
Then I want automatically to return to the list of messages. Without ajax I used the script below.
<script type="text/javascript">
<!--
var URL = "messages.php"
var speed = 1000
function reload(){
location = URL
}
setTimeout("reload()",speed);
//-->
</script>
<?php
I tried to configure this script to load the content of first tab (list of messages), but no success - it doesn't load anything (just hangs) or loads the whole website in one tab.
The only solution is to show a link where to click to return to the messages index.
<a href="javascript:linkjax('messages.php', 'aca', 0)">
Return to the messages index
</a>
But I don't like this. It's very annoying if you need to click somewhere after each deleted message.
Is there any way how to reload (refresh) tab content automatically?
Thank you.
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm
3) Describe problem:
I call a php script to delete a forum message (in the same tab):
<a href="javascript:linkjax('forum.php?do=delete&mid=<?=$i['id']?>', 'aca', 0)">
Click here to delete message
</a>
I click on link, php script deletes message and shows confirmation:
<?php
echo "Message deleted. Please wait...";
?>
Then I want automatically to return to the list of messages. Without ajax I used the script below.
<script type="text/javascript">
<!--
var URL = "messages.php"
var speed = 1000
function reload(){
location = URL
}
setTimeout("reload()",speed);
//-->
</script>
<?php
I tried to configure this script to load the content of first tab (list of messages), but no success - it doesn't load anything (just hangs) or loads the whole website in one tab.
The only solution is to show a link where to click to return to the messages index.
<a href="javascript:linkjax('messages.php', 'aca', 0)">
Return to the messages index
</a>
But I don't like this. It's very annoying if you need to click somewhere after each deleted message.
Is there any way how to reload (refresh) tab content automatically?
Thank you.