データベースが更新されていますが、成功のコールバックがトリガーされていません。ajax 呼び出しの前にアラートを配置すると機能しますが、ajax 呼び出しの後に配置すると機能しません。ajax関数の外であっても。
成功のコールバックをトリガーするにはどうすればよいですか?
$('li').click(function() {
var task_id = $(this).parent().attr("task_id");
var task_box = $(this).parent().parent().parent().attr("id");
var new_color = $(this).attr('class');
$.ajax({
type: "POST",
url: myBaseUrl + 'tasks/updateColor',
data: {id: task_id, color: new_color},
success: function(response, status) {
//$(task_box).attr('class', new_color);
alert(response);
},
error: function(response, status) {
alert(results);
//alert('error');
}
});
return false;
});