Skip to main content

Where can I find a very simple jQuery/AJAX Coldfusion tutorial? [closed]



Edit: After following a few tutorials I am stuck here





I am new to jquery but have some experience with Coldfusion. I have been desperate for an easy tutorial that shows how jQuery/AJAX pulls a query from a ColdFusion9 CFC and displays it on the HTML calling page. I tried following this ben_tutorial but it is too complex for me. There is also a another tutorial , but I do not want to install a plugin. Where should I be looking? I am googling "jquery ajax coldfusion"


Comments

  1. check this:

    there is a simple quickstart tutorial.

    http://www.365labs.net/cf_jquery/jquery_coldfusion_quickstart.htm

    ReplyDelete
  2. Some links I found are:


    http://blog.pengoworks.com/index.cfm/2011/3/3/Easy-AJAX-using-ColdFusion-jQuery-and-CFCs
    http://blog.kukiel.net/2011/09/jquery-coldfusion-and-cfdump-into-div.html
    http://tutorial43.learncf.com/
    Help with return data using ColdFusion and jQuery Ajax


    You can almost never go wrong reading these blogs for coldfusion


    bennadel.com
    coldfusionjedi.com
    http://cflove.org/

    ReplyDelete
  3. I assume you have a fair knowledge of HTML. To accomplish the sort of thing you are asking, use this snippet:

    $.get("coldfusion-page.cfm",function(data){
    $("#displaydiv").html(data);
    });


    $.get is a shorthand method that simply retrieves the given URL. The function() part that follows it is what is run when the request to the coldfusion page completes. All it does is put the data that came back into the HTML tag with an ID of "displaydiv".

    It really doesn't get simpler than this.

    ReplyDelete
  4. You didn't elaborate on what you want to update on the client side. Forms are common, so if you have client side html form like:

    <input type="text" name="title">
    <input type="text" name="date">
    <input type="text" name="author">


    You would generate and send a JSON string with coldfusion. The JSON string could look something like:

    {"title" : "mytitle", "date" : "mydate", "author" : "myauthor"}


    To update the data on the client side you would execute (coldfusion-page.cfm is the name of your server side ajax responder):

    jsonOBJ = {};
    $.ajax({
    type: "GET",
    url: "coldfusion-page.cfm",
    cache: false,
    success: function(data){
    jsonOBJ = jQuery.parseJSON(data);
    for (var key in jsonOBJ) {
    $("input[name=" + key + "]").val(jsonOBJ[key]);
    }
    },
    });


    OR, If you just want to update a div or textarea like:

    <div id="uniquedivname"></div>


    you just send the html/text and replace the success function in the ajax call with:

    success: function(data){
    $("#uniquedivname").html(data);
    },

    ReplyDelete

Post a Comment

Popular posts from this blog

Why is this Javascript much *slower* than its jQuery equivalent?

I have a HTML list of about 500 items and a "filter" box above it. I started by using jQuery to filter the list when I typed a letter (timing code added later): $('#filter').keyup( function() { var jqStart = (new Date).getTime(); var search = $(this).val().toLowerCase(); var $list = $('ul.ablist > li'); $list.each( function() { if ( $(this).text().toLowerCase().indexOf(search) === -1 ) $(this).hide(); else $(this).show(); } ); console.log('Time: ' + ((new Date).getTime() - jqStart)); } ); However, there was a couple of seconds delay after typing each letter (particularly the first letter). So I thought it may be slightly quicker if I used plain Javascript (I read recently that jQuery's each function is particularly slow). Here's my JS equivalent: document.getElementById('filter').addEventListener( 'keyup', function () { var jsStart = (new Date).getTime()...

Is it possible to have IF statement in an Echo statement in PHP

Thanks in advance. I did look at the other questions/answers that were similar and didn't find exactly what I was looking for. I'm trying to do this, am I on the right path? echo " <div id='tabs-".$match."'> <textarea id='".$match."' name='".$match."'>". if ($COLUMN_NAME === $match) { echo $FIELD_WITH_COLUMN_NAME; } else { } ."</textarea> <script type='text/javascript'> CKEDITOR.replace( '".$match."' ); </script> </div>"; I am getting the following error message in the browser: Parse error: syntax error, unexpected T_IF Please let me know if this is the right way to go about nesting an IF statement inside an echo. Thank you.