Solved

this.callback javascript

Posted on 2011-09-14
5
194 Views
Last Modified: 2012-05-12
Hi

As per my knowledge

 var my_alert = function ShowAlert() {  
            alert("This is the test message");  
        }  
        my_alert();  

Open in new window


is call back but I am not sure what is this,callback().

Please advice.

Regards
Karan Gupta
0
Comment
Question by:KaranGupta
5 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 36540864
Please show some context.
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36540877
check this link for some good discussion
http://stackoverflow.com/questions/483073/getting-a-better-understanding-of-callback-functions-in-javascript

example that you posted is more of a delegation than callback.
Callback is mostly used for asynchronous execution to make sure that there is some method waiting for execution when the original method returns back.

For example, call back methods for ajax calls
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 167 total points
ID: 36540881
0
 
LVL 4

Assisted Solution

by:h4hardy
h4hardy earned 167 total points
ID: 36540895
Hi karan,

here is the good article to get the better idea about the callback function JavaScript,

http://pietschsoft.com/post/2008/02/JavaScript-Function-Tips-and-Tricks.aspx
0
 
LVL 7

Assisted Solution

by:Kishan Zunjare
Kishan Zunjare earned 166 total points
ID: 36545017
Callback functions are used in JavaScript (JS) extensively. They are required for AJAX/XHR, event handling, and in popular JS libraries.

http://onemarco.com/2008/11/12/callbacks-and-binding-and-callback-arguments-and-references/
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question