this is the piece of the code I have. By default, "ajax_info_box" is hidden, by clicking "button", "ajax_info_box" shows and sends request, it probably takes about 5 seconds to result. How do I cancel and clear the request by click “cancel"? Any help would be appreciated.
$('.ajax_info_box').hide()
$('.button').click(function() {
$('.ajax_info_box').show()
var xhr = $.ajax({
type: "POST",
url:
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
do something here
});
$('.cancel').click(function () {
suppose to kill the request here
$('.ajax_info_box').hide()
});
});