AJAX help

Topology

Member
Feb 24, 2011
2,395
225
0
Out of Elakiri.
ඒකට AJAX ඕනා නෑ. මේක වැඩ. මම fiefox වල check කරා.
වෙන උදව්වක් ඕනා නම් PM කරන්න.


:rolleyes:

<html>
<head>



</head>

<body>

<table border='1' cellpadding='5' cellspacing='5'>
<tr>
<td><img src="" id="img_main" /></td>
<td><input type="button" value="Load Image" onclick="imageLoading()" />
</tr>
</table>

<script type='text/javascript'>
//image element should be hidden once the page was loaded
document.getElementById("img_main").style.display = "none";

function imageLoading()
{
document.getElementById("img_main").style.display = "block";
document.getElementById("img_main").src = "http://www.mp3unsigned.com/resources/images/loading.gif";
var imgObj = new Image();
imgObj.src= "http://earthobservatory.nasa.gov/images/imagerecords/0/885/modis_wonderglobe_lrg.jpg";
document.getElementById("img_main").src = imgObj.src;
}

</script>


</body>
</html>
 
  • Like
Reactions: delmar

ManZzup

Member
May 25, 2010
6
1
0
<script>
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}else{
//put your image loading code here
}
}
xmlhttp.open("GET","loading.php",true);
xmlhttp.send();
</script>
 
  • Like
Reactions: delmar