?
Solved

this.callback javascript

Posted on 2011-09-14
5
Medium Priority
?
199 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 75

Expert Comment

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

Expert Comment

by:Gurvinder Pal Singh
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:
Gurvinder Pal Singh earned 668 total points
ID: 36540881
0
 
LVL 4

Assisted Solution

by:h4hardy
h4hardy earned 668 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 664 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

Command Line Tips and Tricks

The command line is a powerful tool at the disposal of every Linux user. Although Linux distros come with beautiful user interfaces, it's worthwhile to learn the command line because it allows you to do a number of things that you otherwise cannot do from the GUI.  

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

764 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