You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Basic_Concepts/Promise/README.md
+49-5Lines changed: 49 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -12,10 +12,54 @@ that you use in lessons. syntax
12
12
13
13
explaination and links for more)
14
14
15
-
## Element to explain
15
+
## HTML
16
16
17
-
(for example console.log)
17
+
All the HTML tags are having the following syntax:
18
18
19
-
***Links***
20
-
- Wikipedia
21
-
- Anotherlink,com
19
+
<TAG></TAG>
20
+
21
+
Which the tag with the / is that tag that defines where the tag's area is ending. Here is a short explanation for the HTML tags that we used.
22
+
23
+
-**HTML** tag defines the area that the html code applies.
24
+
-**HEAD** tag includes the html properties of the side. The design elements that are not visible on the page, (like the content do) but the contribute to the appearance and the functionality of the page.
25
+
-**BODY** tag defines the body of the page. The content of the page, (text pictures and other things that the designer want to include to his page). Are the visible and update able content of the page.
26
+
-**SCRIPT** defines the area that we insert a script, (for example JavaScript). This tag is used in both HEAD and BODY tags
27
+
28
+
## JQuery
29
+
30
+
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.
31
+
The basic syntax of Jquery is:
32
+
33
+
$(selector).action()
34
+
35
+
which
36
+
37
+
- The sign $ defines that we will work will work with jQuery.
38
+
- The selector that defines what will activate our action
39
+
- 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.
40
+
41
+
for this example:
42
+
43
+
<script>
44
+
$.getJSON('http://jsonip.com')
45
+
.done(function (data) {
46
+
$('body').append(data.ip);
47
+
})
48
+
.fail(function () {
49
+
$('body').append('<p>Oh no, something went wrong!</p>');
50
+
})
51
+
.always(function () {
52
+
$('body').append('<p>I promise this will always be added!</p>');
53
+
});
54
+
</script>
55
+
56
+
We used the *.done*, the *.fail*, the *.always* and the *.append* action:
57
+
The *.done* is a handler that is activated when a function or another action that is selected is done.
58
+
The *.fail* is a handler that is activated when a function or another action that is selected fails on what it was supposed to do.
59
+
The *.always* is a handler that is activated when a function or another action that is selected is not activated yet.
60
+
The *.append* action appends, with other words prints something to the selected area.
61
+
62
+
For more information check the [W2schools' documentation on jQuery](http://www.w3schools.com/jquery/jquery_syntax.asp)
63
+
64
+
65
+
> Written with [StackEdit](https://stackedit.io/).
0 commit comments