일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
- error
- java
- interface
- Github
- Linux
- learning
- javascript
- mysql
- Web
- Pattern
- centos
- 함수
- Server
- mariaDB
- Deep
- Numpy
- 자바
- Spring
- Python
- Security
- DeepLearning
- LIST
- framework
- 인공지능
- Analysis
- data
- git
- SSH
- ai
- db
- Today
- Total
PostIT
[AngularJS/JQuery] AngularJS에서 Ajax통신 시 JQuery와 문법 차이 본문
# AngularJS와 JQuery Ajax 통신 시 문법 차이
1. Angular JS
$http({
/* HTTP 통신 방법 */
method : 'GET',
/* 통신 할 URL */
url : root + "/news/list-json",
timeout : 600000,
/* 보낼 변수 */
params : {
"currentPage" : currentPage
},
/* 데이터 타입. */
responseType : 'json',
headers : {
"Content-Type" : "application/json; charset=utf-8",
"Accept" : "application/json",
csrfHeader : csrfToken
}
}).then(function(response) {
console.log("Success");
}, function(error) {
console.log("Error" + error);
});
2. Jquery
$.ajax({
/* HTTP 통신 방법 */
type : "GET",
/* 통신 할 URL */
url : root + "/survey/binding/bind/group",
timeout : 600000,
/* 보낼 변수 */
data : {
"surveyBindingGroupId" : surveyBindingGroupId
},
/* 데이터 타입. */
dataType : "json",
beforeSend: function(xhr) {
xhr.setRequestHeader("Accept", "application/json");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader(csrfHeader, csrfToken);
}, success : function(response) {
console.log("Success");
}, error : function(xhr, status, err){
console.log('Error');
}
});
'Script > Angular' 카테고리의 다른 글
[AngularJs/1.6] AngularJS이용시 필요한 모듈에 대한 정보 (0) | 2017.02.15 |
---|