Results 1 to 5 of 5

Thread: Is this done in AJAX or php?

  1. #1
    Join Date
    Jul 2011
    Posts
    36
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Is this done in AJAX or php?

    Hi,

    http://imgur.com/gallery when you scroll to the bottom more content is displayed without the page reloading. How is this done?? My only guess is ajax?? Can someone point me to the right direction thanks.

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    It is ajax which probably uses php as well.

    This thread relates to this somewhat http://www.dynamicdrive.com/forums/s...ad.php?t=64281
    Corrections to my coding/thoughts welcome.

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    AJAX is a method in Javascript to dynamically load a page on the server. Although that page can be just plain HTML, it is most often a serverside language (such as PHP, ASP, CGI, JSP, etc.) so that new dynamic content from the server (such as a database) can be loaded.
    In other words, it's not usually "PHP or Ajax". Ajax is the method for loading something (often PHP) in the browser.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    One could use AJAX for that. Or, since it's images, something like:

    http://www.appelsiini.net/projects/lazyload

    could be used.

    Oddly enough, AJAX would probably be easier to make be the way it's done on that page you linked to. And from my experience in the past working with Lazy Load, probably more cross browser.

    You could include some PHP, to like grab the images from a folder. But if you already know the images, no PHP would be required.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Right: the reason that PHP (or another serverside language) is [probably] required for this is that Javascript won't know the paths to all of the images. That would require preloading all of that information into JS when the page originally loads, still using PHP to do it, and it would load a limited amount inefficiently: if it's too few, then you wouldn't be able to continue loading pages, but if it's too many, then that's a waste of processing and bandwidth every time the page is loaded.

    The cleanest way to do this, in my opinion, would be to use Javascript to generate a standard layout and add it to the page's current HTML source. It would also use Ajax to request a list of new images (along with descriptions and whatever else is required). You would use an array of some sort, potentially XML, probably best as JSON. Then those would be inserted into that standard layout. There's no point in transferring the HTML layout every time since it never changes.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •