--------------------------------------------------------------------------------hi i am trying to build a ajax based flash funny movie viewerthe goal in making this viewer was to make it so the user would never need to refresh his or her page sorry it is hard to explain the problem without showing the code firsthere is the link to see it http://www.licut.com/movie/index.phphere is the ajax code
Quote:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><script language="javascript"> var xmlHttp;function getlist(){ xmlHttp=GetXmlHttpObject();if (xmlHttp==null){alert ("Your browser does not support AJAX!");return;} var url="./list.php";url=url+"?sid="+Math.random();xmlHttp.onreadystatechange=stateChanged;xmlHttp.open("GET",url,true);xmlHttp.send(null);}function stateChanged() { if (xmlHttp.readyState==4){ document.getElementById("main").innerHTML=xmlHttp.responseText;}}function GetXmlHttpObject(){var xmlHttp=null;try{// Firefox, Opera 8.0+, SafarixmlHttp=new XMLHttpRequest();}catch (e){// Internet Explorertry{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}return xmlHttp;}// JavaScript Documentvar xmlHttp;function getheader(movieid, user){ xmlHttp=GetXmlHttpObject();if (xmlHttp==null){alert ("Your browser does not support AJAX!");return;} var url="./header.php";url=url+"?movieid="+ movieid;url=url+"&user="+ user;url=url+"&sid="+Math.random();xmlHttp.onreadystatechange=stateChanged;xmlHttp.open("GET",url,true);xmlHttp.send(null);}function stateChanged() { if (xmlHttp.readyState==4){ document.getElementById("topmenu").innerHTML=xmlHttp.responseText;}}function GetXmlHttpObject(){var xmlHttp=null;try{// Firefox, Opera 8.0+, SafarixmlHttp=new XMLHttpRequest();}catch (e){// Internet Explorertry{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}return xmlHttp;}</script><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><script language="javascript">function onload2(){getheader(1,"michael");getlist();}</script></head><body onload="onload2()"><div id="targetDiv">l</div><div id="topmenu">.loading...</div><div id="sidebar">loading..</div><div id="main">loading....</div> -</body></html><link href="/movie/movie.css" rel="stylesheet" type="text/css" />
now i can state at my problem if you look at the body it state an onload="" where it calls the function onload2 onload2 call the two ajax function the first one is a header that get the date from a php file same thing as getlist know in each of these ajax function after the data is retrieved it goes into these div here is the code that put the retrieved info into these div idsfor getheader()Quote:
document.getElementById("topmenu").innerHTML=xmlHttp.responseText;
for getlist()
document.getElementById("main").innerHTML=xmlHttp.responseText;
if you see these div id are stated correctly but if you look at the link example on top of the source code you would see that getlist() has loaded right in topmenu instead of div id mianthat is my problem i do not understand why this is occuring i am a newb to ajaxsorry for the spellingand i have tried to state my question the best as i can if you need any info just reply thank you in advance