GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — JavaScript-Lessons/Basic_Concepts/Callback at master · mithunpk/JavaScript-Lessons

Expand file tree

/

Callback

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

Callback

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
README.md
README.md
 
 
index.html
index.html
 
 
main.js
main.js
 
 

README.md

Outline

Callback

A callback is a function that is called after another function is done executing. Good for when you are making API calls, and want function to run only after data is retrieved from server.

Course Documentation

JQuery

It is clear that we use the help of JQuery for our purpose, and it could be extremely usefull in this point to explain the basic syntax of an JQuery statement.
The basic syntax of Jquery is:

$(selector).action()

which

  • The sign $ defines that we will work will work with jQuery.
  • The selector that defines what will activate our action
  • And the action of course that we wish to use. the best way to describe an action is to describe it as an special function that comes from jQuery and interacts with an element of our code.

for this example:

$("button").click(function () {
            $("p").hide("slow", function () {
                alert("The paragraph is now hidden");
            });
        });  

We used the .click and the .hide action.
The .click activates a function or another action when we click the selector.
The .hide action hides the area that is defined by the selector.

For more information check the W2schools' documentation on jQuery

##Javascript functions

According to W3schools:

A JavaScript function is a block of code designed to perform a particular task.

A JavaScript function is executed when "something" invokes it (calls it).

function myFunction(p1, p2) {
    return p1 * p2;              // The function returns the product of p1 and p2
}

###JavaScript Function Syntax

A JavaScript function is defined with the function keyword, followed by a name, followed by parentheses ().

Function names can contain letters, digits, underscores, and dollar signs (same rules as variables).

The parentheses may include parameter names separated by commas: (parameter1, parameter2, ...)

The code to be executed, by the function, is placed inside curly brackets: {}

function name(parameter1, parameter2, parameter3) {
    code to be executed
}

Function parameters are the names listed in the function definition.

Function arguments are the real values received by the function when it is invoked.

Inside the function, the arguments behave as local variables.

#The New Boston

Links

  • Support
  • thenewboston.com
  • Facebook
  • Twitter
  • Google+
  • reddit

Written with StackEdit.

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.