Hello all,

I'm want to do a PHP redirect within a <DIV>.

Currently I have written the folowing code, that allows a database entry to be selected and be deleted.

//This is from a file named delete.php
$sql="SELECT * FROM $tbl_name";

      if(isset($_POST['delete'])) {
      foreach($_POST['checkbox'] as $id){
      mysql_query("DELETE from $tbl_name WHERE id =$id LIMIT 1");


[B]echo "<meta http-equiv=\"refresh\" content=\"0;URL=viewdiary.php\">";[/B]


I have highlighted the code that redirects from the delete.php to the page viewdiary.php.

What I want to accomplish is let this run in a div.

Note that my div id is the following

<div id='news1'>

I am using the following jquery statement.

<a href="#" onclick="ajax_loadContent('news1','index.php');return false">My Diary</a>

This works fine and to elaborate it allows me to load content into a <DIV> area, but obviousy I need to incorporate this into the above mentioned code.

Please help and thank you in advance.


6 Years
Discussion Span
Last Post by rosekrans
echo "<script type='text/javascript>window.location.href='http://www.example.com/';</script>";

Thnx for the reply. This script only takes me to a new page. As stated I want it to load within a div. Is there someway to use the div id within the link?


how about

echo "<script type='text/javascript>ajax_loadContent('news1','index.php');</script>";


I think i tried the above myself one time and it didnt work. hence i do this below

You can get the page to return code eg.

echo "Y";
echo "N";

Then on the ajax:

if(responseText == 'Y'){

That way you are still on the javascript of the main page and can change the content of the div still.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.