<div dir="ltr"><div><div><div>Hi!<br><br></div>I have problem creating a button  in a toolbar over a map that will made an ajax request. I havent find a GeoExt ajax class so I am trying to use the Ext.Ajax.request inside a GeoExt.Action like this:<br>
<br><br>    Ext.onReady(function() {<br>        Ext.state.Manager.setProvider(new Ext.state.CookieProvider());<br>        <br>        var ctrl, toolbarItems = [], action, actions = {};<br>        action = new GeoExt.Action({<br>
                    control: Ext.Ajax.request({<br>                                type: &#39;GET&#39;,<br>                                url : &#39;test/&#39;,<br>                                success: function(response, opts) {<br>
                                      var obj = Ext.decode(response.responseText);<br>                                      console.dir(obj);<br>                                       },<br>                                 failure: function(response, opts) {<br>
                                      console.log(&#39;server-side failure with status code &#39; + response.status);<br>                                       }<br>                        }),<br>            map: map,<br>
            text: &quot;max extent&quot;,<br>            tooltip: &quot;zoom to max extent&quot;<br>        });<br>        toolbarItems.push(action);<br><br>        new Ext.Window({<br>            title: &quot;Layer&quot;,<br>
            height: 800,<br>            width: 1000,<br>            items: [{<br>                xtype: &quot;gx_mappanel&quot;,<br>                map: map,<br>                center: map.center,<br>                zoom: map.zoom,<br>
                tbar: toolbarItems<br>            }]<br>        }).show();<br><br><br></div>I see that the request is automatically performed when the page is refreshed, but the map do not  load correctly. What is the proper way to achieve that?<br>
<br>Thank you,<br></div>Max Demars<br clear="all"><div><div><div><div><br>-- <br><div dir="ltr"><div><div><div>Stack Overflow: <a href="http://stackoverflow.com/users/1914034/burton449">http://stackoverflow.com/users/1914034/burton449</a><br>
</div></div>GIS Overflow: <a href="http://gis.stackexchange.com/users/14426/burton449">http://gis.stackexchange.com/users/14426/burton449</a><br></div>LastFm: <a href="http://www.lastfm.fr/user/burton449">http://www.lastfm.fr/user/burton449</a><br>
</div>
</div></div></div></div></div>