ajax call

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
theBond
Forum Newbie
Posts: 19
Joined: Thu Jul 17, 2008 7:46 pm

ajax call

Post 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';
            }           
        });
}
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: ajax call

Post 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).
(#10850)
Post Reply