jquery - Call jsonp callback inside a TypeScript module (devextreme) -


i call jsonp callback typescript module of devextreme. following code not working. call weatherresponse callback, it's inside typescript module.

module tellmeweather {     export function home(params: { id: }) {          return {             locationvalue: ko.observable("new york"),             locationresults:ko.observable("no results"),             gosearch: function ()              {                  $.ajax({                     url: 'http://api.openweathermap.org/data/2.5/weather?q='                          + this.locationvalue() + ',it&callback=weatherresponse',                     datatype: 'jsonp',                     jsonp: 'weatherresponse',                     success: function () {                      }                 });             }             ,             weatherresponse: function (locdata:any)             {                     this.locationresults("location name:"+locdata.name);                }         };     } } 

don't specify 'jsonp' parameter @ all. let jquery work out. ajax request following

$.ajax({     url: 'http://api.openweathermap.org/data/2.5/weather?q=' + this.locationvalue() + ',it&callback=?',     datatype: 'jsonp' }).done(function(result) {     // code here }); 

you can find working script on github https://github.com/nils-werner/owm-display/blob/master/js/loader.js


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -