PDA

View Full Version : External URL in Ext.Ajax.request



spendkar
18 Mar 2011, 5:47 AM
How to send Ajax request to an external URL from Ext.Ajax.request. I tried using ScriptTagProxy as seen in below code. It is not working.


Ext.Ajax.request({
proxy: new Ext.data.ScriptTagProxy({
url: 'http://www.MYSITE.com/handleData.php'
}),

params: {
task: "SYNCITEMDATA",
data: Ext.encode(data)
},
success: function(response){ },
failure: function(response){ }
});

spendkar
18 Mar 2011, 7:24 PM
Bump +

walldorff
18 Mar 2011, 8:42 PM
Please do not bump. When forum members find the time they will anwer you.

In the mean time I suggest you carefully study the docs and search the forum.
If necessary use Google (http://www.google.be/webhp?q=sencha+scripttagproxy).

varunach
18 Mar 2011, 10:35 PM
With ScriptTagProxy the response should be a javascript function with the data passed as the function's ONLY parameter

tdikarim
22 Mar 2011, 6:44 AM
Hi,

I use this solution. I simulate an Ajax request by using a dataStore with ScriptTagProxy.
That's works for me.



var AjaxCall = new Ext.data.JsonStore({
proxy: new Ext.data.ScriptTagProxy({
url:'http://xxx.xxx.xxx.xx/php/execute.php'
}),
baseParams:{
action: 'sendEmail'
,data : Ext.util.JSON.encode(JSonData)
,dateLaunch : this.tb_dateField.getValue().format('Y-m-d') || null
,userNAme: this.app.memberInfo.name
},
reader: new Ext.data.JsonReader({
root: 'results',
totalProperty: 'total'
},
[{name:'id',type:'numeric'}, {name: 'result_name',type: 'string'}]
)
});
AjaxCall.load({params : {start : 0}});


Enjoy

TDIKarim