By the way, here are a couple more ways to do this - the first one grabs both
field values and sends them.  You would get form.interest and form.principal
in cold fusion.  The second one replaces the post's callback with an
anonymous function so you can see that they work the same way:


$(document).ready(function(){

        $("#Principal").blur(function(){ doPost(); });
                         
        $("#Interest").blur(function(){ doPost(); });

});

function doPost(){
        $.post("test.cfm", { principal:$("#Principal").val() ,
interest:$("#Interest").val() }, handleCallback)
}

function handleCallback(data) {
        $("#Result").empty().append(data);
}

For an anonymous callback, dump the handleCallback function and move it into
the callback of $.post in doPost():

function doPost(){
        $.post("test.cfm", { principal:$("#Principal").val() ,
interest:$("#Interest").val() }, function(data){
$("#Result").empty().append(data); })
}

Since, in this example, you don't have 2 post functions trying to call the
same result, it is ok to encapsulate everything in one line.


Rick Faircloth wrote:
> 
> Thanks for the advice on Firebug and the debug code, Daemach.
> 
> I've been using it for a few days, but haven't learned it well.
> It has been good about notifying me of syntax errors, however!
> 
> Rick
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Daemach
> Sent: Tuesday, March 13, 2007 11:51 PM
> To: [email protected]
> Subject: Re: [jQuery] Ok... one last effort to make this work... help!
> 
> 
> I second that - if you're not using firebug, you should drop everything
> else
> until you get familiar with it (seriously).  Use console.log(),
> breakpoints,
> watches, and the net tab or console for debugging ajax calls.  You can see
> what data is going to and from the server on every call.
> 
> You should also add:
> 
> jQuery.fn.debug = function() {if (typeof window['console'] !==
> 'undefined'){console.log(this);}  return this;}  
> 
> to the bottom of your jquery.js file, or create a separate plugin file
> with
> just this code in it and load it after jquery.  Then you can insert it
> into
> jquery chains to see the results of selectors in the console. 
> $("p").debug().addClass(......).....etc.
> 
> 
> 
> Rick Faircloth wrote:
>> 
>> Thanks, Paul... I'll start working on that!
>> 
>> Rick
>> 
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
>> Behalf Of Paul
>> Sent: Tuesday, March 13, 2007 11:25 PM
>> To: 'jQuery Discussion.'
>> Subject: Re: [jQuery] Ok... one last effort to make this work... help!
>> 
>> Two broad suggestions: First, get familiar with Firebug; in addition to
>> just
>> js errors its messages will alert you to 404 errors (which you would have
>> caused by calling a file in the wrong folder) as well as 500 errors
>> (which
>> are the result of CF errors) and save you a lot of time wondering why
>> ajax
>> isn't working.  Second, poke through the tutorials on jquery.com, which
>> explain the basics and will turn you on to the possibilities.  
>> 
>> Now back to your question, assuming you're like me and develop in
>> iterations, I would simply start by copy/pasting the .blur() binding for
>> each field:
>> 
>> $("#Some-Field-ID").blur(function(){ //assign a blur event to the input
>> $.post("callpage_Validate_Mortgage_Inputs.cfm",
>> {some-variable-name:$("#Some-Field-ID ").val()}, function(data){
>> 
>> When I start by taking the easy way out like this, I typically begin to
>> see
>> how it works and realize along the way how to make it more tidy.
>> 
>> You'll also need to handle the POST variables that will be different on
>> the
>> CF side; assuming it existed in v 4.5, CF's structKeyExists(form,
>> "some-variable-name") function would do the trick.
>> 
>> And of course, the usual disclaimer: there are better ways to accomplish
>> this task (Jorn's plugin being one of them), but this will get you
>> started.
>> 
>> -pm
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> jQuery mailing list
>> [email protected]
>> http://jquery.com/discuss/
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Ok...-one-last-effort-to-make-this-work...-help%21-tf3
> 399722.html#a9468102
> Sent from the JQuery mailing list archive at Nabble.com.
> 
> 
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
> 
> 
> 
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Ok...-one-last-effort-to-make-this-work...-help%21-tf3399722.html#a9478705
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to