JSFiddle - React, Tailwind, and code Playground
HTML
<button id="mango" >Load More</button>
JavaScript
var maxnumId = null,
counteri= null,
totali =null;
function callApi() {
$.ajax({
type: "GET",
dataType: "jsonp",
cache: false,
// change this with your url
url: "//jsfiddle.net/echo/jsonp/",
success: function(data) {
var i;
// because i cannot reproduce your response ajax i commented this
//maxnumId = data['pagination[next_num_id]'];
for (i = 0; i < 100; i++) {
// because i cannot reproduce your response ajax i commented this
// document.myform.outputtext.value = document.myform.outputtext.value+data.data[i].images.ok.url+'\n' ;
}
counteri = i;
totali = totali +i;
alert('counteri is now: ' + totali);
}
});
}
$("#mango").on("click",function(){
callApi();
});