Below is my code
Same code is working in local server but not in live.
htmlC = \"\";
htmlC += \'
Using string concatenation in this manner is usually a bad idea, especially if you don't know the number of iterations you will be doing. Every time you concatenate a string, you will reallocate the memory needed to fit the new string and need to garbage collect the old one (which might not even be done during the loop for performance reasons)
var htmlBuffer = [];
htmlBuffer.push('');
htmlC = htmlBuffer.join('\n');
The above will define an array, to which you push each "row" onto. It will dynamically allocate memory needed for the expanding data, and finally, you allocate 1 string for the total amount of data . This is much more efficient. I don't know if this is the actual problem in your case (since we don't know what tot_pages are), but it's never a bad idea to avoid string concatenations in loops anyway.