2
나는 extjs4에서 일하고 있습니다. 나는 날씨 모듈에서 일하고있다. 지금은 내가보기에이 temp_c 변수의 값과 도시를 표시 할extjs에서보기에 변수를 표시하는 방법은 무엇입니까?
getWeather : function() {
var getdata=this.getipaddress();
console.log(getdata);
var city = "pune";
var urllink="http://api.wunderground.com/api/4ab310c7d75542f3/geolookup/conditions/q/IA/" + city + ".json";
console.log(urllink);
Ext.require('Ext.data.JsonP', function() {
Ext.data.JsonP.request({
//url : "http://api.wunderground.com/api/4ab310c7d75542f3/geolookup/conditions/q/IA/pune.json",
url:urllink,
success : function(parsed_json) {
var location = parsed_json['location']['city'];
var temp_c = parsed_json['current_observation']['temperature_string'];
alert("Current temperature in " + location + " is: "
+ temp_c);
return temp_c;
var viewObj=Ext.create('Balaee.view.sn.user.weather');
var viewObj.show();
}
});
});
},
된 직후 컨트롤러 코드의 도움으로 날씨 정보를 가져 오는 중 오류입니다. 나는이 두 변수를 직접 가지고있다. 나는 그것에 관련된 어떤 가게도 가지고 있지 않다. 나는 내가보기를 가지고 있다고 가정한다 .-
Ext.define('Balaee.view.sn.user.weather',
{
extend:'Ext.view.View',
id:'weatherId',
alias:'widget.weatherView',
config:
{
tpl:'<tpl for=".">'+
'<div id="main">'+
'</br>'+
'<b>City :- </b> {city} </br>'+
'<b>Temp:- </b> {temp_c} </br>'+
'</div>'+
'</tpl>',
itemSelector:'div.main',}
}); 위의보기에서 값이 표시되지 않습니다. 이러한 변수를 표시하는 방법은 무엇입니까?
다음Ext.define('Balaee.view.sn.user.weather',{
extends:'Ext.container.Container',
alias:'widget.weatherView',
tpl:Ext.create('Ext.XTemplate',
'<div id="main"></br>',
'<b>City :- </b> {city} </br>',
'<b>Temp:- </b> {temp_c} </br>',
'</div>')
});
Ajax 응답 :
고맙습니다 ... – user1722857
나는 그것이 당신을 도왔다 니 기쁩니다. – XenoN