Table loading using ajax bellow..
$.ajax({
type:"POST",
url:"loadquestionsajax.php",
data:"qcategory="+qcategory,
dataType:"json",
success: function(s){
$.each(s,function(i,obj)
{
if(obj!=false){
while(i<1){
$("#t01").append("<tr>"+"<th><input type='checkbox' class='cbox' value=''/></th>"+"<th>Question ID</th>"+"<th>Question</th>"+"<th>Choice 1</th>"+"<th>Choice 2</th>"+"<th>Choice 3</th>"+"<th>Choice 4</th>"+"<th>Answer</th>"+"</tr>");
i++;
}
$("#t01").append("<tr>"+"<td><input type='checkbox' name='qtns[]' class='cbox' value='"+obj[0]+"'/></td>"+"<td>"+obj[0]+"</td>"+"<td>"+obj[1]+"</td>"+"<td>"+obj[2]+"</td>"+"<td>"+obj[3]+"</td>"+"<td>"+obj[4]+"</td>"+"<td>"+obj[5]+"</td>"+"<td>"+obj[6]+"</td>"+"</tr>");
}else{
exit();
}
});
}
});
and my event handler is code bellow. ( it is not calling even checkbox checking.) Please help me. Thanks in Advance.
$(document).ready(function(){
$(document).on('click', '.cbox', function(){
alert('test');
});
});
and I used bellow code also.
$(document).ready(function(){
$('.cbox').change(function(){ // .click also seen but not workig.
alert("hello")
;
});
});
Aucun commentaire:
Enregistrer un commentaire