I have the following script in a .js-file:
I call the script using the following HTML:
<a href="#" value="category_subcategory_brand_.html" onclick="showProducts(this.value)" >link</a>
It's working in IE, but no other browsers, any ideas? In FF and other browsers except IE the variable "str" comes up as undefined.
Thanks on beforehand.
Code:
var xmlHttp
function showProducts(str)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var strs = str.split('_');
var str1=strs[0];
var str2=strs[1];
var str3=strs[2];
var url="list.php?"
url=url+"&subcat="+str1
url=url+"&cat="+str2
url=url+"&bra="+str3
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("ajaxy").innerHTML=xmlHttp.responseText
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
//Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
I call the script using the following HTML:
<a href="#" value="category_subcategory_brand_.html" onclick="showProducts(this.value)" >link</a>
It's working in IE, but no other browsers, any ideas? In FF and other browsers except IE the variable "str" comes up as undefined.
Thanks on beforehand.






