I made a function loadcomputers()
that otomatically update a select list with id=computer
loadcomputers()
gets the filter form the input field with id="rating"
input field with id="rating"
is automatically filled out by another function rate(item)
Problem is when input field with id="rating" is automatically filled out, the function loadcomputers() dosn't load but if I type manually it works
<div>
<ul>
<li>
<input class="ccheckbx" type="checkbox" name="application[]" value="1" onClick="rate(this);" />Office
</li>
<li>
<input class="ccheckbx" type="checkbox" name="application[]" value="2" onClick="rate(this);" />Game
</li>
</ul>
<input type="text" id="rating" oncchange="loadcomputers()"/>
<select name="computer" id="computer"></select>
</div>
--------------------------------------------------
var total = 0;
function rate(item){
if(item.checked){
total+= parseInt(item.value);
}else{
total-= parseInt(item.value);
}
//alert(total);
document.getElementById('rating').value = total + "";
}
-------------------------------------------
function loadcomputers() {
$val = $('#rating').val();
$.post('http://exemple1.com/action/subs/pcdrop2.php', {
rating: $val
}, function (data) {
$('#computer').html(data);
});
}