Page 1 of 1

ajax call

Posted: Sat Aug 30, 2008 8:28 am
by theBond
This code is working fine. But i wanted to know if i am doing any wrong here. I am calling a function inside another function

Code: Select all

onComplete: function (){
  $('msg').innerHTML = 'i am here'; 
 
}
  inside good()
 
 
 
 
function good()
{
    var url = 'myurl';
    var pars = 'param1=' + param1;
    
    var myAjax = new Ajax.Request(
        url,
        {
            method: 'get',
            parameters: pars,
                onComplete: function (){
                
                $('msg').innerHTML = 'i am here';
            }           
        });
}

Re: ajax call

Posted: Sat Aug 30, 2008 9:49 am
by Christopher
You are not calling a function inside a function. You are passing a function to be called later when the request is complete (onComplete).