1
게시 방법을 사용하여 서버에서 데이터를 가져오고 싶습니다. 내 cordova 응용 프로그램에서이 Cordova HTTP plugin 사용하고 있습니다. 그러나 나는 그 튜토리얼을 이해하지 못한다. 나는 머리글에 전자 메일 ID & 암호를 보내고이 코드를 사용하여 서버에서 데이터를 가져 오려고합니다.웹 서버에서 데이터 가져 오기 Cordova HTTP
cordovaHTTP.post("https://google.com/", {
id: 12,
message: "test"
},{ Authorization: "OAuth2: token" }, function(response) {
// prints 200
console.log(response.status);
try {response.data = JSON.parse(response.data);
// prints test
console.log(response.data.message);
} catch(e) {
console.error("JSON parsing error");
}}, function(response) {
// prints 403
console.log(response.status);
//prints Permission denied
console.log(response.error);
});
위의 코드를 수정하고 데모 변수를 사용하여 이해하십시오.