Javascript callback

August 17, 2007 § 3 Comments

What is it?

Callback is an executable code that is passed to other functions as parameter.

Why is it useful?

When doing AJAX stuff it is impossible not to have callbacks. Callbacks are needed because Javascript in a browser is single threaded. Therefore order of execution could be achieved by chaining callbacks.

Reference:

Definition [Wikipedia]

Advertisements

§ 3 Responses to Javascript callback

  • derekjoe says:

    what settings are required for callback a function defined in javascript and passing json as a parameter to that function.
    I have finished writting both of them but i am not able to pass my script to javascript using callback technique in the url

  • didip says:

    @Derek:

    The next step you need to do is to build XmlHttpRequest object.

    With this object you can then send the content of your JSON to your specified URL.

    Hope that helps.

    One more thing, almost all of javascript framework can help you with building XmlHttpRequest task.

    Some examples are Mochikit or MooTools.

  • screwlewse says:

    I think it would be helpful to show some code examples.
    Here is one that creates several ajax requests. (using the next ajax as a callback)

    http://ajaxian.com/archives/serial-async-xhr

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading Javascript callback at RAPD.

meta

%d bloggers like this: