I am hoping one of the javascript pros here can offer assistance.
home.php
ajaxFunctionItem.js
javascript Code:
function getXMLHTTP() { //fuction to return the xml http object
var xmlhttp=false;
try{
xmlhttp=new XMLHttpRequest();
}
catch(e) {
try{
xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
try{
req = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e1){
xmlhttp=false;
}
}
}
return xmlhttp;
}
function getCapacity(categoryId) {
var strURL="includes/findcapacity.php?category="+categoryId;
var req = getXMLHTTP();
if (req) {
req.onreadycapacitychange = function() {
if (req.readycapacity == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('capacitydiv').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
function getItems(categoryId,capacityId) {
var strURL="includes/finditems.php?category="+categoryId+"&capacity="+capacityId;
var req = getXMLHTTP();
if (req) {
req.onreadycapacitychange = function() {
if (req.readycapacity == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('itemsdiv').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
findcapacity.php
finditems.php
Thank in advance for your help.
Problem: I cant get the second drop down to populate.