我在AJAX成功处理程序中收到此错误。
ReferenceError:找不到变量:getresult
我正在尝试调用一个名为getresult
的函数,但是我觉得getresult
似乎是一个变量?这是jQuery:
$('#button').click(function(){
var data1 = $('#comments').val();
$.ajax({
type: "POST",
url: "/modules/business/submitPost.php",
data: ({ dat1: data1}),
cache: false,
success: function(data) {
$("#comments").val("");
$("#comments").css('height', 'auto');
$("#comments").height(this.scrollHeight);
$('#imagepreview').attr('src', "");
$("#imagepreview").hide();
$("#faq-result").html("");
getresult('/modules/business/getresult.php?page=1');
}
});
});
function getresult(url) {
$.ajax({
url: url,
type: "GET",
data: {
rowcount: $("#rowcount").val()
},
beforeSend: function() {
$('#loader-icon').show();
},
complete: function() {
$('#loader-icon').hide();
},
success: function(data){
$("#faq-result").append(data);
},
error: function(){}
});
}
$(window).scroll(function() {
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
if ($(".pagenum:last").val() <= $(".total-page").val()) {
var pagenum = parseInt($(".pagenum:last").val()) + 1;
getresult('/modules/business/getresult.php?page='+pagenum);
}
}
});