Problem with jquery load function
I have a page where I use the jquery load function to load data from a php file. The problem is that it does not always return the correct number of results. I have tried receiving the data straight from the php file and that worked perfectly. What could cause this problem with the load function?? It should only return a max of 5 entries.
s_showLoader();
$("#s_content").load("sdata.php", {s_page:1, user:fbusername}, s_hideLoader);
The show and hide loader functions just show and hide a gif loader. page is the page of pagination to display and user is just used to verify the user is logged in.
UPDATE 1: Here is example of what the sample return looks like. It is in a while loop and is generated for each entry that is returned.
<table border="0">
<tr><td width="500">
<?php if($s_rows['name']){ echo $s_rows['name']; }else{ echo "User"; } ?><?php echo " | <a id='s_datedata".$s_idnum."'>".$s_rows['date']."</a>"; ?>
<div class="s_label<?php echo $s_idnum; ?>"><?php echo $s_display; ?></div>
<br&开发者_C百科gt;<a href="#" class="s_entry-info" id="<?php echo $s_idnum; ?>">More Info...</a><br>
<div class="list_con" id="s_condata<?php echo $s_idnum; ?>"><?php echo $s_rows['content']; ?></div>
<div class="list_tags" id="s_contags<?php echo $s_idnum; ?>"><?php echo $s_rows['tags']; ?></div>
</td>
<td width="10" align="right"><!-- delete button if correct user is logged in-->
<?php
if($user && ($fbuser == $s_rows['fb_id']) ){
//show delete button
?>
<a href=""><img src="close-icon.png" title="Click here to delete your listing" class="delopt" id="<?php echo $s_idnum; ?>" onclick="return del_list(<?php echo $s_rows['id']; ?>,<?php echo $s_rows['fb_id']; ?>)" height="25" width="25" alt="delete" border="0"></a>
<?php
}else{
//echo $fbuser."|".$rows['fb_id'];
}
?>
</td>
</tr>
</table>
UPDATE 2: This is the only POST variable in the php file. The rest of the data comes from the standard facebook api.
$s_page_num = floor($_POST['s_page']);
You can use html content instead of load.
function Load_Content() {
$.ajax({
url: 'yourfilename.php',
cache: false,
data: "s_page="+s_page_value,
success: function (html) {
$("#s_content").html(html);
}
});
}
精彩评论