1
JSON 형식으로 제공하는 웹 서비스에서 일부 통화 가격을 받고 싶습니다. 나는 응용 프로그램을 실행하고 클라이언트에있는 버튼을 클릭하면, 전 서버의 시간 제한 메시지가Simple Meteor http 호출 시간 초과
if (Meteor.isClient) {
Template.hello.greeting = function() {
return "Welcome to webserve.";
};
Template.hello.events({
'click input' : function() {
// template data, if any, is available in 'this'
if (typeof console !== 'undefined')
console.log("You pressed the button");
Meteor.call('getprice');
}
});
}
if (Meteor.isServer) {
Meteor.startup(function() {
// code to run on server at startup
});
Meteor.methods({
getprice: function() {
console.log('On the server');
var url = "http://quotes.instaforex.com/get_quotes.php?m=json&q=AUDUSD";
//var url ="http://www.google.com";
HTTP.get(url, function(error, result) {
if(!error) {
console.log(result.content);
}
else console.log(error);
});
}
});
}
- 여기
내가 간단한 예제를 사용하고있는 코드 (안녕하세요)입니다. URL을 확인하십시오. 브라우저에 복사/붙여 넣기를하면 코드가 서버 측에 있으므로 올바른 json을 수신하면 도메인 간 정책이 적용되지 않습니다.아이디어가 있으십니까?
코드를 사용하여 새로운 유성 프로젝트 ('http' 패키지로)를 시도했지만 정상적으로 작동합니다. 당신이 짧은 aud가되기를 바랍니다. – Akshat
Nitrous.io 상자에서 새로운 유성 프로젝트로 복사하는 것은 매력처럼 작동했지만 내 Windows 컴퓨터에서 실행하면 시간이 초과되었습니다 ... 내 회사 방화벽으로 뭔가를해야 할 수도 있습니다 – tanmay80