4

Ajax loader question

view full story
linux-howto

http://www.daniweb.com – Hi everyone, I'm very new to this whole ajax / javascript thing and i have a question regarding the image loader. Basically i want to add the image when the ajax is doing its stuff but i can't figure out where i need to put the code. As a matter of fact i dont even know what code i should be writing. Please can someone assist me, google was not very helpful this morning!! function ajaxFunction(){         var ajaxRequest;                  try{                                 ajaxRequest = new XMLHttpRequest();         } catch (e){                                 try{                         ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");                 } catch (e) {                         try{                                 ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");                         } catch (e){                                                                 alert("Your browser broke!");                                 return false;                         }                 }         }                 ajaxRequest.onreadystatechange = function(){                 if(ajaxRequest.readyState == 4){                         var ajaxDisplay = document.getElementById('ajaxDiv');                         ajaxDisplay.innerHTML = ajaxRequest.responseText;                 }         }         var pet = document.getElementById('animals').value;         var queryString = "?id=" + pet;         ajaxRequest.open("GET", "view.php" + queryString, true);         ajaxRequest.send(null); } cheers... (General)