ReportingAnalyst
MIS
Hi,
This question is related to AJAX. I am trying to display a list of products for the category "Beverage" using the Northwind database.
When I click on the link "Beverage", I get thie error - "Unknown runtime error". In the code below, I made the error line bold.
What is causing it?
My code is:
This question is related to AJAX. I am trying to display a list of products for the category "Beverage" using the Northwind database.
When I click on the link "Beverage", I get thie error - "Unknown runtime error". In the code below, I made the error line bold.
What is causing it?
My code is:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]
<html>
<head>
<style type="text/css">
* {
border: 0;
padding: 0;
margin: 0;
}
#menu {
padding:0;
margin:0;
}
#menu li {
list-style-type:none;
}
#menu ul {
padding: 0;
margin: 6px;
list-style-type: none;
}
a.a_style:link {color:#0000ff; text-decoration:none;}
a.a_style:visited {color:#0000ff; text-decoration:none;}
a.a_style:hover {color:#ff0000; text-decoration:underline;}
a.a_style:hover {color:#ff0000; text-decoration:underline;}
</style>
<script type="text/javascript">
var xmlHttp
function showProducts(str)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="Categories_Dynamic1.asp"
url=url+"?ID="+str
alert(url);
//url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged1
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged1()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
//alert("State Changed");
//objID = 'UI_'+el;
//document.getElementById(objID).innerHTML=xmlHttp.responseText
[b]document.getElementById("content_products").innerHTML=xmlHttp.responseText[/b]
}
}
function GetXmlHttpObject()
{
var objXMLHttp=null
if (window.XMLHttpRequest) //Safari, Mozilla browers
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject) //IE browsers
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}
function s_Hide(el){
alert("Showing Element: "+el);
objID = 'UI_'+el;
alert(objID);
obj = document.getElementById(objID).style;
(obj.display == 'none')? obj.display = 'block' : obj.display = 'none';
}
</script>
<title>On Demand Building of tree with User OnClick</title>
</head>
<body>
<form name="Customers" id="Customers" action="">
<ul id="menu">
<li>
<input type="radio" checked="checked" name="prodid" id="Catid1" value="1">
<a href="#" class="a_style" onclick="showProducts(1);s_Hide('1'); return false;">Beverages</a>
<ul id="UI_1">
<div id="content_products">
</div>
</ul>
</li>
</ul>
</form>
</body>
</html>