Note that there are some explanatory texts on larger screens.

plurals
  1. POAjax call back function called always after first call
    primarykey
    data
    text
    <p>I want to do auto load with using ajax call back function but the <code>GetData</code> function is keep being called after first with same parameters. Here is my javascript codes:</p> <pre><code> var currentPage = 0; var isFinished = false; var lastScrollTop = 0; $(window).data('ajaxready', true).scroll(function (e) { if ($(window).data('ajaxready') == false) return; $(window).scroll(function (event) { var st = $(this).scrollTop(); if (st &gt; lastScrollTop) { if (st &gt; window.innerHeight) { var amountValue = $("#amount").val(); var firstPrice = 0; var lastPrice = 10000; InfiniteScroll(firstPrice, lastPrice); } } }); }); function InfiniteScroll(firstPrice, lastPrice) { if (firstPrice &lt; 0 || firstPrice == undefined) { firstPrice = 0; } if (lastPrice &lt; 0 || lastPrice == undefined) { lastPrice = 10000; } if (isFinished) { return; } $('#divPostsLoader').html('&lt;img src="images/loader.gif"&gt;'); var rawPath = window.location.pathname.split('/'); var categoryId = rawPath[rawPath.length - 1]; $("#load").show(); $.ajax({ type: "POST", url: "http://localhost:60579/AjaxCallPage.aspx/GetData", data: "{categoryId:" + categoryId + ",page:" + currentPage + ",skip:'9',firstPrice:" + firstPrice + ",lastPrice:" + lastPrice + "}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { if (data.d.length &lt; 3) { isFinished = true; } var products = JSON.parse(data.d); $.each(JSON.parse(data.d), function () { // ... do smth.. }); currentPage += 1; $("#load").hide(); } }); }; </code></pre> <p>I don't scroll down but it calls <code>GetData</code> function after first call. Do you have suggesiton?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload