Thanks for the help, Daemach!

I'll have a look at implementing this shortly...got to run see
a client.  (Boy...if weren't for clients, I have enough time to code!  :o)

Rick

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Daemach
Sent: Thursday, March 15, 2007 10:29 AM
To: discuss@jquery.com
Subject: Re: [jQuery] Ok... one last effort to make this work... help!


In this case you are handling each of the  results differently so you could
do it by putting anonymous functions directly in the post callbacks like
this: 

$(document).ready(function(){

        $("#Principal").blur(function(){ 
        $.post("callpage_Validate_Mortgage_Inputs.cfm",
{principal:$("#Principal").val()}, function (data)
{$("#Result_Principal").empty().append(data) } ) });
        
        $("#Interest").blur(function(){

$.post("callpage_Validate_Mortgage_Inputs.cfm",{interest:$("#Interest").val(
)},
function (data) {$("#Result_Interest").empty().append(data) }) });
        
        $("#Years").blur(function(){
        
$.post("callpage_Validate_Mortgage_Inputs.cfm",{years:$("#Years").val()},
function (data) {$("#Result_Years").empty().append(data) }) });
        
});

OR you could pass the target div to an outside function like this:

$(document).ready(function(){

        $("#Principal").blur(function(){ 
        $.post("callpage_Validate_Mortgage_Inputs.cfm",
{principal:$("#Principal").val()}, function (data) {
handleCallback("Principal",data); }) });
        
        $("#Interest").blur(function(){

$.post("callpage_Validate_Mortgage_Inputs.cfm",{interest:$("#Interest").val(
)},
function (data) { handleCallback("Interest",data); }) });
        
        $("#Years").blur(function(){
        
$.post("callpage_Validate_Mortgage_Inputs.cfm",{years:$("#Years").val()},
function (data) { handleCallback("Years",data); }) });
        
});

function handleCallback(target,data) {
        $("#Result_" + target).empty().append(data);
}

In general you should avoid creating outside functions inside the
document.ready function for cleanliness if nothing else.





_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to