Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Changes
Page history
Update JQuery
authored
Apr 26, 2022
by
Joel H
Show whitespace changes
Inline
Side-by-side
Web/Javascript/JQuery.md
View page @
70341a1b
...
...
@@ -109,4 +109,24 @@ $.ajax('data/item.json')
})
//Can add a 2nd parameter to ajax to indicate information :
$
.
ajax
(
'
data/item.json
'
,
{
dataType
:
'
json
'
,
contentType
:
'
application/json
'
,
cache
:
false
})
.
done
(
function
(
response
){
console
.
log
(
response
.
items
);
let
items
=
response
.
items
;
items
.
forEach
(
function
(
item
){
addItem
(
item
.
name
,
item
.
description
,
item
.
price
,
item
.
moreInfo
);
})
})
.
fail
(
function
(
request
,
errorType
,
errorMessage
){
console
.
log
(
errorMessage
);
})
.
always
(
function
(){
console
.
log
(
"
always called
"
);
})
```
\ No newline at end of file