добрый день. есть такой код:
function delay(callback, ms) {
var timer = 0;
return function() {
var context = this, args = arguments;
clearTimeout(timer);
timer = setTimeout(function () {
callback.apply(context, args);
}, ms || 0);
};
}
$(document).ready(function () {
$("#search").keyup(delay(function () {
var text = $(this).val();
$.ajax({
type: "POST",
url: "/livesearch.php",
dataType: 'html',
data: {
q: text
},
success: function (text) {
$('#lsresult').html(text)
}
});
}, 500));
});
$(document).ready(function() {
$('.js-tooltip').tooltip();
$('.js-copy').click(function() {
var text = $(this).attr('data-copy');
var el = $(this);
copyToClipboard(text, el);
});
});
$(".form-group>input").keyup(function () {
var t = $(this);
t.next('span').toggle(Boolean(t.val()));
});
$(".clearer").hide($(this).prev('input').val());
$(".clearer").click(function () {
$(this).prev('input').val('').focus();
$('#lsresult').html('');
$(this).hide();
});
$( document ).ready(function() {
var isMobile = window.matchMedia("only screen and (max-width: 760px)").matches;
if (!isMobile) {
$("#search").focus();
}
});
теперь вопрос. как можно протестировать ajax запрос и узнать какой текст приходит с сервера?
спасибо