• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

output data from mysql using CF and Ajax

Explorer ,
Sep 14, 2012 Sep 14, 2012

Copy link to clipboard

Copied

I've been reading a lot lately about ColdFusion Ajax features and even though I learned some basics still need a few tips from you guys to learn more. That being said, I would like to output data from mysql database using cfc and ajax but do not know how to handle ajax part. More specifically need to automatically load additional data when the user scrolls to the bottom of the page. The perfect example of this is Facebook where data (more stories) are loaded every time you get to the bottom. I am not asking for the entire code but some tips (articles) on how to get started and would really appreciate your help on this one

Views

661

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 20, 2012 Sep 20, 2012

Copy link to clipboard

Copied

LATEST

There are really two parts to your question.

First, Ajax is fairly straightforward and there are lots of articles. I would say there are two ways to go about it. After making a function in a CFC you can call it either using CFAJAXPROXY or via a javascript function. The javascript code can be a little tricky however if you use jQuery that will simplify it. CFAJAXPROXY is probably the simplest, but jQuery gives you more direct control over what is going on.

Secondly, Load on scroll is not the simplest task. There maybe a premade jQuery plugin that will help you with this. Otherwise I did it by using jQuery scroll methods. You have to judge when a user has scrolled the right amount to load the next section of data, and then just modify the MySQL query to grab the next set of data.

Hope this helps a little

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation