Делаю так, но почему-то не работает, в чем проблема? пытаюсь передать habdle
клика функции SendAjax
, чтобы там заместо this
обращаться к элементу:
function SendAjax(flag, event){
var type = $(event).val();
var id_question = $(event).closest('div').attr('rel');
$.ajax({
type: 'POST',
url: 'controller.php',
data: 'type='+ type + '&id_question=' + id_question + '&flag='+flag,
success: function(data){
$('#question_'+id_question).hide();
id_question++;
if($("#findID").length) {
$('#question_'+id_question).show();
} else {
SendAjax(1, e)
}
}
});
}
$(function() {
$("#finish").click(function(e) {
SendAjax(1, e)
});
$(".question input:radio").click(function(e) {
SendAjax(0, e);
});
});