javascript - $.ajax, complete function (no more data to get) -


im new .ajax , far good. i've run issue of, want run function once i've used data.

for example have following, run on 'click':

$.ajax({         url: "url.modal.tothegoods" + (nextpage),         success: function (data) {              //keeps appending data on click         },         error: function () {                 alert('balls');         }   }) 

i've tried ajaxcomplete function runs everytime load data onto screen.

it runs everytime appened data .ajaxcomplete runs. guess questions is, how run function once have no more data consume. done

any tips/tricks appreciated

the response depends on behaviour of server part.

if have hand on it, simple solution returns nothing when there no more data send. may simple this:

$.ajax({         url: "url.modal.tothegoods" + (nextpage),         success: function (data) {              if (!!data) {              //keeps appending data on click              }         },         error: function () {                 alert('balls');         }  }) 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -