spiderwell Posted July 16, 2011 Share Posted July 16, 2011 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 https://forums.phpfreaks.com/topic/242153-paging-with-jquery/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.