0

I am printing checkbox's value on combobox value using AJAX, but showing undefined.
First time it ok, but When checkbox is clicked then value is set to be off, showing undefined.

Here is the code.
Checkbox

<input type="checkbox" name="course_inactive" value="off" id="course_inactive" onclick="check(this.value); value2(this.value)">

Combobox
<div style="float:right; height: 26px; padding-top:2px;" id="div_courses">
<select id="course" name="course" style="width:125px" onchange="selectBatch(this.value); showCourseBatch(this.value, document.getElementById('batch').value, document.getElementById('orderby').value, document.getElementById('sortby').value, document.getElementById('course_inactive').value)">
<?php
foreach ($options_courses as $index => $value)
{
echo ' <option value="' . $index . '"';
if ($index == $course_to_preselect)
{
echo ' selected ';
}
echo '>' . $value . '</option>';
}
?>
</select>
</div>

AJAX Function
function showCourseBatch(str,str1,str2,str3,str4)
{
//alert(str2+' '+str3 );
alert(str4);
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="SelReceiptByCourse.php";
url=url+"?c="+str;
url=url+"&b="+str1;
url=url+"&orderby="+str2;
url=url+"&sortby="+str3;
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by twiss
This question has already been answered. 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.