Jump to content

paging with jquery


spiderwell

Recommended Posts

I am having a go at making a site with a lot of jquery ajax stuff.

 

I have an image with a class of manageusers, and when clicked it loads up the users listings. I think want to turn the paging links to do the same thing but also pass which page, however it wont pass them as a link it just does a normal GET method to the page. So i tried an laternative method of turning the link into a span with the same classname, and adding cusotm attributes to pass the info instead and that doesnt seem to work either!!

 

any help would be apprciated, I know there is a simple way to do it, but I cant seem to find one online. in my code I have only 1 record per page just for testing

 

$('.manageusers').click(function(e) {
$("#loading").show();
var thiscache = $(this);
    page = thiscache.attr("page"); 
    direction = thiscache.attr("direction"); 
    order = thiscache.attr("order");
    var dataString = "page="+ page + "&order=" + order + "&direction=" +direction;     
alert(dataString);
$.ajax({  
			type: "GET",  
			url: "a/a_manageusers.php?",  
			cache: false,
			success: function(html) {
			data: dataString,  
			$('#admincontainer').html(html); 

			},
			error: function() {
			$("#admincontainer").show();
			$('#admincontainer').html('<span class="red">There was an error fetching the users</span>'); 
			}
		});  
$("#loading").fadeOut(800);
e.preventDefault();

 

 

then the html in the page looks like this:

<div id="admincontrol">
<img src="../images/users_two_48.png" class="manageusers" border="0" width="30">
</div>


<div id="admincontainer">
<ul style="margin: 0px; padding: 0px;">
<li style="background-color: rgb(238, 238, 255);" id="userorder_28" class="listtext" onmouseover="style.backgroundColor='#ffffff';" onmouseout="style.backgroundColor='#eeeeff';">
<div class="userfullname">
Johnny Alpha</div><div class="usergallery">
<span style="font-style: italic;"></span>   </div><div class="username">
Johnny</div>
</li>

<li id="paging" class="listtext">  
<span style="font-style: italic; float: right;">Page 1 of 3 </span>  1  
<span class="manageusers" order="ID" direction="DESC" page="2">2</span>
<span class="manageusers" order="ID" direction="DESC" page="3">3</span>
</li>

</ul>
</div>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.