0

I am populating combobox on checkbox checked or not click event.
Here is code. I am not solving the bug, JS runs on chrome but not in both IE and Firefox.

checkbox
<input type="checkbox" onclick="selectinactivebatch(this.value);" id="inactive_batch" name="inactive_batch" <?php if(isset($_POST)) echo "checked";?>>

AJAX Code
function selectinactivebatch(checkboxvalue)
{

var check;
if(checkboxvalue=='on')
check=1;
else
check=0;
alert(check); // Always showing value 1
xmlhttpbatch=GetXmlHttpObjectbatch(this.value);
if (xmlhttpbatch==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="selectBatch.php";
url=url+"?action=inactive_batch_collection";
url=url+"&val="+check;
xmlhttpbatch.onreadystatechange=stateChangedbatch;
xmlhttpbatch.open("GET",url,true);
xmlhttpbatch.send(null);
}

function GetXmlHttpObjectbatch()
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
return new XMLHttpRequest();
}
if (window.ActiveXObject)
{
// code for IE6, IE5
return new ActiveXObject("Microsoft.XMLHTTP");
}
return null;
}

function stateChangedbatch()
{
if (xmlhttpbatch.readyState==4)
{
document.getElementById("txtBatch").innerHTML=xmlhttpbatch.responseText;
}
}

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by twiss
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.