Reputation: 681
The loop gives me the last li using the var westring. Is there a way to attach or append it to the post URL?
$(document).ready(function() {
var westring = '0';
$('#infinite_topic_scroll').scrollLoad({
url : '/challenges_side.php?f=hh&start_res='+westring+'&v=y',
getData : function() { },
start : function() { $('<div class="loading"><img src="/images/ajax-loader.gif"/></div>').appendTo(this); },
ScrollAfterHeight : 95,
onload : function( data ) {
$(this).append( data );
$('.loading').remove();
},
continueWhile : function( resp ) {
var westring = ($(this).children('li').length);
// alert(westring);
if( $(this).children('li').length >= 100 ) { return false; }
return true;
}
});
});
Upvotes: 0
Views: 104
Reputation: 10941
I can't find much on the plugin you're using specifically, but I think what you're looking for is in...
getData : function() { }
Try something like this...
[...]
url : '/challenges_side.php',
getData : function()
{
return {
"f" : "hh",
"v" : "y",
"start_res" : $(this /* or element selector */).children('li').length.toString()
};
},
[...]
I could be wrong, but it's worth a shot
Upvotes: 1
Reputation: 2991
Get rid of the var inside the continueWhile function. You already placed the var in the above scope. Also, I would cast it to a string.It should just be
westring = $(this).children('li').length.toString()
Upvotes: 1