Hello,

I am adding record with AJAX. I have done this earlier but that time i had taken the value which i was passing thorugh ajax was taken by the post method.

but here the value is already there. it means this is fetched result so according to blogid i am showing the other values related to that blog.

well, i just want to add this blogid as favorite blog of the logged in user.

here is my code.
blogprofile.php

PHP Code:
<?php
echo "<div id='".$blogdata->blogid."'>";
echo 
"<a href='javascript:ReportComment($blogdata->blogid);' title='My favorite'>My Favorite</a>";
echo 
"</div>";

?>
ajax.js
Code JavaScript:
/* XMLHTTPRequest Enable */
 /* ---------------------------- */
 function createObject() {
 var request_type;
 var browser = navigator.appName;
 if(browser == "Microsoft Internet Explorer"){
 request_type = new ActiveXObject("Microsoft.XMLHTTP");
 }else{
 request_type = new XMLHttpRequest();
 }
 return request_type;
 }
 
 var http = createObject();
 
 
 /* -------------------------- */
 /* INSERT */
 /* -------------------------- */
 /* Required: var nocache is a random number to add to request. This value solve an Internet Explorer cache issue */
 var nocache = 0;
 function msgdelete(id){
       document.getElementById(id).innerHTML = "<em>deleting...</em>";
   alert("hello");
 
 
               http.open('GET', 'delete.php?id='+id);
  	     http.onreadystatechange = insertReply1;
               http.send(null);}
 
function insert(blogid){
 
document.getElementById(blogid).innerHTML = "<em>inserting...</em>";
 
 alert("hello");
 http.open('GET', 'myfav.php?blogid='+document.getElementById('blogid').value);
 
 
http.onreadystatechange = insertReply;
http.send(null);
 
 }
 function insertReply() {
  if(http.readyState == 4){
  var response = http.responseText;
  // else if login is ok show a message: "Site added+ site URL".
  document.getElementById('insert_response').innerHTML = 'Friend'+response;
  }
  //return(blogid);
}

myfav.php
PHP Code:
<?php
ob_start
();
//ini_set( "display_errors", 0);
include("includes/functions.php");

include(
"includes/config.php");


usersess();
$uid         $userid;
$op = new amd;

$blogid $_GET['blogid'];
if(
$blogid){


    
$link mysql_connect('***''**''**')
          or die(
'Could not connect: ' mysql_error());
      
mysql_select_db('**') or die('Could not select database');

    echo  
"INSERT INTO favourite(blogid,uid,favourite) VALUES ('98778', '7978', 'Y')";
    
$addfavourite mysql_query("INSERT INTO favourite(blogid,userid,favourite) VALUES ('$blogid', '$userid', 'Y')");
     if(
mysql_affected_rows($addfavourite) > 0){


    echo 
"your favourite is added";
    }else
    {

    echo 
"your favorite is not added";
    }

}
  
?>
Now the status is i am getting hello alert as well as showing me the inserting message. but nothing is happening further.

can anyone have look on my code and tell me what is wrong i am donig.

thanks in advance.