We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40748
    • 55 Posts
    Hi everyone!

    I'm making a weather dashboard widget and get JSON data from another website.

    This is my widget code:

    <script type="text/javascript">
    Ext.onReady(function(){
    	Ext.util.JSONP.request({
                url: 'http://api.openweathermap.org/data/2.5/weather?q=London,uk&callback=',
                callbackKey: "callback",
    	    scope: this,
                callback: function(c) {    
                console.log("ok");
    // got an error :: Uncaught TypeError: Cannot read property 'request' of undefined
                }
            })	
    });
    </script>
    


    I have an error in console - Uncaught TypeError: Cannot read property 'request' of undefined.

    Can somebody give me an idea what is wrong?

    Thank you!

    P.S.
    MODX Revolution v. 2.3.3
    Widget type: HTML

    This question has been answered by mixa_ru. See the first response.

      Cheap and ready landing pages: http://real-portal.biz
      Start selling fast, good for dropshipping
    • discuss.answer
      • 40748
      • 55 Posts
      It looks like that's not possible to do it with MODExt because it uses ExtJS 3 and JSONP method was included since ExtJS 4.0.0:

      http://docs.sencha.com/extjs/4.0.0/#!/api/Ext.data.JsonP

      I will try jQuery (or may be plain javascript) or php function file_get_contents().
        Cheap and ready landing pages: http://real-portal.biz
        Start selling fast, good for dropshipping