Getting started with Ajax - how do I query the db without 'submitting' the page?

Hi guys,
I'm building a simple 'power point presentation' - basically a cf page which will display a large jpg [a slide]) every n seconds I want the page to query the db to ask if it needs to change the jpg and if so which jpg should it now show. In this way we can control the presentation by updating the database on the fly.
So I think I will acheive this as follows:
1. a 'display' page that contains javascript that fires every n seconds
2. that js to somehow pass 2 variables (GET?) to an action page (ie user id and an authentication var)
3. the action page will the query the db (using the vars passed in step 2)
4. the action page returns a result (path to jpg to display) which somehow(?!) is passed back to the display page
5. the display page then swaps the jpg it is showing for the one passed back to it in step 4
6. ideally the display page then also passes another 2 variables to the action page letting us know it has received the update and changed the image accordingly
I'm fine with all the html and cfm stuff - where I am stuck is the js bits, I've had a good look through google and don't seem to be making any progress so if anyone could please point me in the right direction I'd be ever so grateful.
Any snippets / advice very gratefully received
TIA
Nick

Hi Nick -
Let me also recommend jQuery.
Fantastic stuff once you get the hang of it, and even the simple stuff is cool.
Ok... here's what I did...
There are probably better ways to do it, but I cheated, in that I did it my way, and got some good results.
Using divs to define my display areas here's what I did:
I have 2 select statements -
1) Selecting from 1 populates the other select.
2) The JS function is triggered when a selection is made.
3) The Ajax statement goes out to a web page, that new page does a query and creates a new div with the same name as "txtResult", for my example.
4) The Ajax then pulls back the new page and displays it.
It's pretty easy after a few tries.
Hope this helps.
Doug
function dynamic_Select(poolID){
$.ajax({
type: "GET",
url: '/forms/selectSchedules.cfm',
data: "id=" + poolID,
dataType: "text/html",
success: function(html){
    $("#txtResult").html(html);    
    <div style=" padding-left:100px;">   
        Select Pool:
        <select name="pool" onchange="dynamic_Select(this.value)" />
        <option value="#" selected="selected">-Select-</option>
        <cfoutput query="pools">
        <option value="#poolID#">#poolName#</option>
        </cfoutput>
        </select>
        <span id="txtResult" style=" padding-left:100px;">
            Select Schedule:
            <select name="schedules" id="schedules" onchange="getInfo()">
            <option></option>
            </select>
        </span>
    </div>

Similar Messages

  • I recenlty forgot my phone password to my iphone 4 and i dont have an computer to sync it up with. How can I not do it without an computer?

    When i did the updated that just came out the i07.3 when it told me i wanted a password i just hit next and i never had a password or anything on this phone. i dont have a computer so i can sync it up with. How do you restore my iphone4 without using the computer. HELP

    It should still work as an iPod, how is it disabled?

  • How can I use the NI PXI-6508 with Lab View 7? what are the first steps to get started??How can I use the channels with lab view 7????

    I have a 8 slot PXI system with 2 NI PXI 6508 and 1 DMM 4070 in it. I want to get started with programming the digital I/O cards (6508)! How can I use this cards with LabView 7?what is the best way to get started, or where can I get examples showing how to use the several channels?
    Thanks!
    Philipp

    Philipp,
    The best way to get started is to decide if you want to use traditional NI-DAQ or NI-DAQmx. Recently we released NI-DAQ 7.1 which provides NI-DAQmx support for the PXI-6508. In my opinion, NI-DAQmx is more efficient and much easier to use.
    To get started with examples, simply launch LabVIEW and go to Help>>Find Examples. Then expand Hardware Input and Output>>DAQmx and select the appropriate digital group for your application. This should help get you started.
    Please repost if you need addition assistance. Good luck with your application!

  • Just updated to latest version , getting started with Mozilla Firefox opens everytime not homepage , how do I get rid of unwanted page

    I upgraded to the latest version of Firefox , when I hit the icon and firefox opens the first page that comes up is the Getting started with Mozilla Firefox and not my home page , I have checked everything I could find and nothing keeps this page from opening like it's my home page . also I unloaded download helper for the same reason , it keep opening up wanting me to upgarde to the latest version , I already had upgraded , I don't know what is going on , My home system was upgraded early last week and works fine , I double checked all setting between the two systems , nothing , Please let me know where to look , thank you , a longtime fan of Firefox.

    Hi Romulus949,
    You should take a look at the Knowledge Base article [[How to set the home page]].
    There are steps in that article to reset your homepage preferences to default. I would try that first to clear out any strangeness. Then you can set your homepage to anything you like.
    If that doesn't work you should look at [https://support.mozilla.com/kb/Firefox+has+just+updated+tab+shows+each+time+you+start+Firefox this article about that specific issue] and the article [http://kb.mozillazine.org/Preferences_not_saved Preferences not saved].
    Hopefully this helps!

  • How to get start with JDeveloper

    How can I get started with JDeveloper

    Hi,
    Maybe by having a look on the different tutorials:
    http://www.oracle.com/technology/obe/obe1013jdev/index.htm
    That depends on the technologies you want to use, for ADF that could help:
    http://download-east.oracle.com/docs/cd/B25221_04/web.1013/b25386/index.htm
    Good luck,
    Tif

  • FAQ: Common Lightroom workflows, or How do I get started with this program?

    Starting to use a new application can be intimidating, especially one as sophisticated as Lightroom. Here is a handy list of resources to help you with your Lightroom workflow:
    Getting Started Tutorials
    10 Things Beginners Want to Know (Video, 36:28) from How to Get Started with Lightroom 4 with Terry White
    How And Why You Should Use Adobe Lightroom
    Beginners Guide on How to Use Lightroom 3
    Photoshop Lightroom Tutorials Roadmap
    A wealth of Lightroom tutorials (John Nack)
    The Official Lightroom resource center
    The Lightroom home page
    The Lightroom 4 Users Guide
    Continually updated resources
    Learn Photoshop Lightroom 4
    Learn Lightroom 4 Channel on Adobe TV
    Julieanne Kost's Lightroom tutorial videos
    Lightroom tutorials on Photoshop.com
    Layers Magazine Lightroom Tutorials
    Lightroom Killer Tips
    Additionally, check out the rest of the Lightroom FAQ.
    Follow Lightroom through social channels to receive a constant stream of tutorials:
    Facebook
    Google+
    Twitter
    YouTube (Check out the Getting Started with Lightroom series of videos)

    contact adobe support, http://www.adobe.com/support/chat/ivrchat.html

  • How to disable "getting started with Firefox" web page when starting Foxfire?

    Every time I open Firefox I get the additional web page "getting started with Firefox" and do not know how to disable it. Can you help?

    The page may be set as an additional home page, the following link shows how to check and set your home pages - https://support.mozilla.com/kb/How+to+set+the+home+page

  • How do I eliminate the "getting started with firefox" page that appears everytime I click on my home page?

    Every time I click on my home page I get an additional window "Getting Started with Firefox". How do I eliminate this?
    == This happened ==
    Every time Firefox opened
    == Immediately

    See [[How to set the home page]]: Firefox supports multiple home pages separated by '|' symbols.
    See also this article for more suggestions: [[Firefox has just updated tab shows each time you start Firefox]]

  • How to get started with ePrint?

    I am new to the ePrint and need instructions on getting started. Thank you

    Hi nojean, welcome to the ePrint/Mobile printing discussion board on the HP Support Forum!
    I'm including a couple of links here that will help you get started using the ePrint service.
    Getting Started with ePrint videos 
    Start Here - How to and troubleshooting
    Hope the information contained in the these links helps you get up and running with HP's ePrint service.
    If my reply helped you, feel free to click on the Kudos button (hover over the "thumbs up").
    If my reply solved your problem please click on the Accepted Solution button so other Forum users may benefit from viewing the post.
    I am an HP employee.

  • I never used LabView but need to generate a RS-233 serial output string that contains an IRIG timestamp based on a contact closure. Is LabView an appropriate tool to do this? How much does it cost to get started with the product?

    I never used LabView but need to generate a RS-233 serial output string that contains an IRIG timestamp based on a contact closure. Is LabView an appropriate tool to do this? How much does it cost to get started with the product?

    Labview isn't cheap, but it would certainly allow you to build a program (set of vi's - virtual instruments) that would do what you describe. Where would the timecode information come from? Your vi, or program, would: Start up, initialize the serial port, loop until a trigger happened, read the timecode (from where?), output that timecode out the serial port in a loop until you pressed the stop button. There is a free evaluation of Labview software available from NI - the base product itself runs about $995.
    - Dave

  • How to get started with SOA

    Hi Experts,
    I am new to SOA, can any one help me how I can get started.
    Documents/ links related to SOA will be a great help.
    Regards-

    10 tips to get started with SOA:
    1. Remember, it’s an architecture.
    2. Don’t confuse SOA with web services.
    3. Function-first, not product first.
    4. Don’t try to make everything service-oriented.
    5. Incremental SOA is a good thing.
    6. Think about how near-term returns complement long-term goals.
    7. Bake security into the architecture from the start.
    8. Expect SOA technology to change a lot.
    9. Push vendors for better investment models.
    10. Find a vendor willing to be a partner.

  • How can i get started with messaging in java

    how can i get started with messaging in java

    If you're talking about writing mail clients in java, you might want to start with a better forum. We're focused on Messaging Servers, here. Unlikely you'll get any Java programming from us.
    If you're talking about Messaging Server, start by downloading the software from sun.com/downloads.

  • FAQ: How do I get started with Photoshop Elements Editor, or What do all these tools do?

    Opening an image editing application for the first time can be intimidating. The more powerful the tool, the more complicated it can be to learn to use. Below are a list of resources to help you get started with the Photoshop Elements Editor.
    I just bought Photoshop Elements, where do I start?
    There are a lot of directions you can go when you first make your purchase. Here is your first roadmap.
    Getting Started Tutorials
    What do all these terms mean?
    There are some common words tossed around when talking about image editing or tool use. Here is a helpful guide to define these: Photoshop Elements key concepts
    Photoshop Element Help Topics:
    Workspace basics
    Tools
    Color and tonal correction basics
    Elements Basics, an overview of Elements' essential concepts on Photoshop Elements User.com
    Where can I find some tutorials on the web?
    There are many resources for learning Photoshop Elements on the internet. Here are some that we recommend.
    Photoshop Elements: Where can I find some good basic tutorials? on the Photoshop Feedback site.
    Like Photoshop Elements on Facebook for daily tutorials and inspiration. As well as the occasional contest.
    Editing Tutorials for Photoshop Elements on Photoshop.com
    Getting Started with the Elements Editor on Photoshop Elements User.com
    Photoshop Elements for Dummies.com
    What about video tutorials?
    Some find it easier to watch a product being demonstrated and explained by an expert
    Learn Photoshop Elements 11 on Adobe TV
    Photoshop Elements channel on YouTube
    Where can I find books about learning Photoshop Elements?
    Photoshop Elements books on Pearson Peachpit Press

    Hi Christoph and WarriorAnt,
    Thank you both for the replies.
    I don't know anything about GarageBand because I've never used it. I've never used any music software before, (other than iTunes, Ha!)
    I don't have GarageBand on my Mac because it wasn't stock on the old Powerbook G4, so I would have to buy it. I'm happy to do that if I can figure out that it does what I want ... but I'm overwhelmed by the info at Apple's site. Too much for a beginner like me. Even the wikipedia.com entry for GB uses too many terms I don't know, so I'm easily lost.
    I just want to be able to set up drum loops and play along with them. The main thing is that I'm able to use third party loops. There are so many really amazing loop products out there ... jungle drums, acoustic jazz drums, lounge, etc. I don't want to get caught up in anything proprietary (like Band-In-A-Box) because the selection is limited. I'm sure GarageBands loops are great, but I want access to all these other third party loops as well ... loops that were not specifically made for GarageBand.
    Will GarageBand let me drop in any and all drum loops from these other companies?
    And does GarageBand work like a basic sequencer, where I can program up an intro, X number of measures of a loop, then a turnaround, then a variation loop, then an ending, etc?
    I know the high-end stuff like Native Instruments Kontakt does this, but unfortunately it also does a kazillion other professional-level things I will never need and don't want to pay for (and which make the software more complex and daunting).
    Thank you again, both of you, for responding and helping me with this project.
    Just a little more advice on those two questions would really go a long way.
    -JOHN

  • How do I stop the Getting started with Mozilla Firefox page from opening everytime I start Firefox. If I have to see that everytime then I will delete Firefox for good...!!!!

    Everytime I start firefox since the last update I can't get the stupid Getting started with firefox page to stop opening up. I downloaded the version 8 and it still opens ..

    Well the latest and Greatest Firefox Version 8.0. Won't let me change my home page no matter what I do it always comes back with the getting started page and my orignal home page.
    What a piece of garbage it is turning into..!!!!

  • How to remove "Get started with your site"

    Hello,
    I am in the process of automating the creation of a site collection using PowerShell. Everything works fine but I would like to remove or hide the "Get started with your site" that we see the first time we open a site. Deactivating the Getting
    started feature will not remove it.

    For other readers, here's the full script needed:
    # First, get a reference to the target web app:
    $web = Get-SPWeb "[TargetSiteURL]"
    # Assuming that 1) the web page file that you want to examine is
    # the default landing page and 2) Publishing has been activated
    # for the containing site collection, the following gets you a
    # reference to the web part manager:
    $wpm = $web.GetLimitedWebPartManage("pages/default.aspx", [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared).WebParts
    # Note the "pages" in the path. Next, the following lists out
    # all web parts on this page:
    $web.GetLimitedWebPartManager("pages/default.aspx",[System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared).WebParts
    # Review this list, and then identify the PartOrder of the web
    # part you want to remove. It its, say, its "5", you get a
    # reference to web part like so:
    $wp = $wpm.WebParts[5]
    # Now delete the web part:
    $wp.DeleteWebPart
    # and close the web app reference:
    $web.Close()
    It's easier to remove the web part directly from the page, while it's in edit mode, but then the scripted method also works when automation is needed.

Maybe you are looking for