jquery - Call Function Inside ajax success results in ReferenceError: Can't find variable: -
im getting error inside ajax success handler.
referenceerror: can't find variable: getresult
i'm trying call function called getresult
error seems think getresult
variable? here 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); } } });
Comments
Post a Comment