|
<%@ Page language="c#" Codebehind="testAjax.aspx.cs" AutoEventWireup="false" Inherits="Rating.testAjax" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>testAjax</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function startRequest() {
//alert(document.getElementById('textbox1').value);
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET", "ajaxRating.aspx?id=" + document.getElementById('textbox1').value + "&imgColumn=3", true);
xmlHttp.send(null);
}
function handleStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
// alert("http://localhost/Rating/images/stars" + xmlHttp.responseText + ".gif");
document.images['myimage'].src = "http://localhost/Rating/images/stars" + xmlHttp.responseText + ".gif";
}
else
{
alert("Error");
}
}
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form action="#">
<input type="button" value="Start Basic Asynchronous Request" onclick="startRequest();"
id="Button1" name="Button1"> <IMG id="myimage" style="Z-INDEX: 101; LEFT: 56px; POSITION: absolute; TOP: 147px" alt=""
src=""> <INPUT id="textbox1" style="Z-INDEX: 102; LEFT: 482px; POSITION: absolute; TOP: 26px" type="text">
</form>
</body>
</HTML>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.