YongJAng 0 Newbie Poster

This JavaScript code is supposed to read an xml document and output it into a table. If the user selects bid, a prompt will ask for a new value and the Start Price will be changed immediately. However, this isn't the case for my code. When I have clicked the Bid button to update the value, it receives a new price and appends it to the xml. However, Start Price on the page does not change. In the console, I receive a GET [object%20Event] Cancelled error. Is this issue the cause of my start price value not refreshing?

This is the JavaScript

var xmlhttp;

if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}

function loadXMLDoc(url)
{
var table
var item
var items
var i;
var sendoff;
xmlhttp.onreadystatechange=function()
{
if ((xmlhttp.readyState == 4) &&(xmlhttp.status == 200))
{
table="<table>";
var serverResponse = xmlhttp.responseXML;
item=serverResponse.documentElement.getElementsByTagName("Product");
for (i=0;i<item.length;i++)
  {
  table=table + "<tr>";
  items=item[i].getElementsByTagName("ItemName");
    {
      table=table + "<td>Item Name : </td>"+"<td>" + items[0].firstChild.nodeValue + "</td>";
      iname =  items[0].firstChild.nodeValue;
      //document.getElementById('test').innerHTML=sendoff;
    }
  table=table + "</tr>";
    table=table + "<tr>";
  items=item[i].getElementsByTagName("Category");
    {
      table=table + "<td>Category : </td>"+"<td>" + items[0].firstChild.nodeValue + "</td>";
    }
  table=table + "</tr>";
  table=table + "<tr>";
  items=item[i].getElementsByTagName("Description");
    {
      table=table + "<td>Description : </td>"+"<td>" + items[0].firstChild.nodeValue + "</td>";
    }
  table=table + "</tr>";
  table=table + "<tr>";
  items=item[i].getElementsByTagName("StartPrice");
    {
      table=table + "<td>Start Price : </td>"+"<td>" + items[0].firstChild.nodeValue + "</td>";
    }
  table=table + "</tr>";
  table=table + "<tr>";
  items=item[i].getElementsByTagName("Owner");
    {
      table=table + "<td>Owner  : </td>"+"<td>" + items[0].firstChild.nodeValue + "</td>";
      iowner =  items[0].firstChild.nodeValue;
      //document.getElementById('test').innerHTML="AA"+iowner;
    }
  table=table + "</tr>";
  table=table + "<tr>";
  table=table + "<td><input type=\"submit\" onclick=\"itembid('"+ iname + "','"+ iowner +"')\" value=\"Bid\"></td>";
  table=table + "<td><input type=\"submit\" onclick=\"\" value=\"Buy It Now\"></td>";
  table=table + "</tr>";
  }
table=table + "</table>";
document.getElementById('listinglist').innerHTML=table;
}
}
xmlhttp.open("GET",url,true);
xmlhttp.send();

}

function itembid(iname,iowner)
{

var newbid = prompt("Please enter your bidding price");
var itemname = iname;
var ownername = iowner;
xmlhttp.open("GET", "readxml.php?newbid=" + encodeURIComponent(newbid) + "&itemname=" + encodeURIComponent(itemname) + "&ownername=" + encodeURIComponent(ownername) +"&date="+ Number(new Date), true);


xmlhttp.send();
xmlhttp.onreadystatechange = loadXMLDoc;
}


This is the php page that the second function calls
<?php
require_once("sessioncheck.php");
header('Content-Type: text/xml');
?>
<?php

$newbid = $_GET["newbid"];
$itemname = $_GET["itemname"];
$ownername = $_GET["ownername"];
if (!empty($_SESSION['fname']))
{
toXml($newbid,$itemname,$ownername);
}

function toXml($newbid,$itemname,$ownername)
{

$xml = simplexml_load_file("auction.xml");
$sxe = new SimpleXMLElement($xml->asXML());
foreach($sxe->children() as $items)
{
    if($items->ItemName == $itemname)
    {
        //echo "Current Price".$items->StartPrice;
        $items->StartPrice = $newbid;
        //echo "New Price".$items->StartPrice;
    }
}
$sxe->asXML("auction.xml");
return $sxe;

}

Could this be linked to the onload function in the body of my html file?

<body onload="loadXMLDoc('auction.xml')"