Hi there. I've tried searching for this in the archive but can't find anything that works. Slowly getting used to AJAX though my main goal works!!!
I'd like to show a little 'loading' image while the request is being retrieved from the server.
This is my Code... (with bold where I think it should go)
Code:
//Browser Support Code
function ajaxUnSaveEvent(){
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
document.getElementById("myDiv").innerHTML=ajaxRequest.responseText;
}
else{document.getElementById("myDiv").innerHTML=image info}
}
var memberid = <?php echo $memberid; ?>;
var gigid = <?php echo $gigid; ?>;
var queryString = "?mem=" + memberid + "&gig=" + gigid;
ajaxRequest.open("GET", "ajaxforgetgig.php" + queryString, true);
ajaxRequest.send(null);
}
</script>
Is this how it works? Also, what would I put instead of 'image info'?
If you could help me out I would be extremely greatful. I've been trying this all night with various methods but no luck!
Many thanks