SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot Zurev's Avatar
    Join Date
    Feb 2009
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Moving or "Live" Front page - cursebird/foursqare

    Ok so I'll be honest, I have a good amount of experience with php/mysql, I've just started learning jQuery and I've done very little, but some with ajax. So using the terms ajax/jquery interchangeably are a bit confusing to me. Anyway as the title suggest I have a website with 5 items, and I want them to move (meaning, if a more recent one is entered, remove the last item, and put the new one on top), they are 5 of the most recent items in the database table, now I've coded jquery as a test so it fades out the last one, the whole thing moves down, makes room at the top, and fades in a new one. However, it's a test and has 0 interaction with the database, the one that fades in is just in a hidden div. So the jQuery part is taken care of.

    So I'm unsure how to go about this, I was thinking maybe have ajax check a website off the page that has those 5 items in raw format, and if they change then to refresh?

    Not looking for a "plz code 4 me" answer, just the concept of how it would work, or some links to get off to the right start.

  2. #2
    SitePoint Member
    Join Date
    Dec 2010
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, you will need to perform an ajax request if you want to collect the latest items from a DB without a page refresh. You also have the issue of when to instigate the refresh, is this going to be a page element event, i.e. (button click) or a implicit refresh interval created by JS, i.e. using setInterval, hope this helps...

  3. #3
    SitePoint Zealot Zurev's Avatar
    Join Date
    Feb 2009
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I actually sort of lied. Hopefully this will help, it complicates things a bit:

    Say I have 5 items that can be ranked, so if I click item 3 and it ranks above item 2, I need it to swap places refreshlessly, should I have the ajax request done every time a vote is initiated, or would that cause too much overhead if the site were to become popular?

  4. #4
    SitePoint Member
    Join Date
    Dec 2010
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You will have to perform an ajax request everytime a vote is initiated as you will need to get the accurate ranking from the DB as there could be many people using your app and updating the DB.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •