Just to clarify that CF ONLY returns JSON in all caps if you use dot
notation. Try it out yourself.

Dot notation
VARIABLES.myStruct.myKey -> VARIABLES.MYSTRUCT.MYKEY

Bracket notation
VARIABLES['myStruct']['myKey'] -> VARIABLES.myStruct.myKey




-----Original Message-----
From: Dave l [mailto:cfl...@jamwerx.com] 
Sent: Sunday, March 28, 2010 7:30 PM
To: cf-talk
Subject: Re: Ajax, Json, and two clueless programmers


first I would use jquery to make it easier but if neither of you know it the
first hurdle you will face is multiple clicks so you should put a div and
class around each link and then use jquery's "live" property which will make
this work right or else you'll be scratchin your head trying to get it.

then in the same function use jquery ajax function to grab info.

Also cfm returns json IN ALL CAPS, so propertyID becomes PROPERTYID in the
returned json.

$(function() {
    $('td.propertyInfo').live('click',
    
        var PropertyID = this.id;
        //the line below is used with a regex to help filter data faster by
adding a
        // longer more specific name to the link to speed it up and then the
regex
        // removes the additional text: example would be: the table row
would be 
        //property id but you shouldn't use that id if it's just a number so
adding 
        //"property-#propertyID#" separates the value from any other
possible conflicts.
        var getDataString = $(this).attr('id').replace(/property-/ig, '');
        var dataString = "id=" + getDataString;
        $.ajax({
            type: "post",
            url: "assets/cfc/process.cfc?method=getPT&returnFormat=json",
            data: dataString,
            dataType: "json",
            cache: false,
            success: function(data) {
                //success code here
                } else {
                    $('#submitIt div').removeClass('btnSpin');
                 //error code here  
                }
            }
        });
        return false;
    });
    return false;
}); 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:332400
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to