Can I make an ajax call to another server?
I am trying to call a centralized server for simple authentication purposes in an intranet environment. Can this be done, or does the call have to be in the same web root?
Thanks for any advice.
Code:
Ext.Ajax.request({
url: 'http://someserver/webservice/TestService',
method: 'post',
params: {
username: a1ws23,
password: 'testadm1n'
},
success: function(response, options) {
alert(response.responseText.trim());
},
failure: function(response, request) {
alert('Failed - ' + response.status);
}
});
Would you have a small example using ScriptTagProxy
Condor:
Would you have a small example please?
dlbjr
That will work Anomal - Thanks!
That will work Animal - Thanks!
Needing ScriptTagProxy to return XML
The code below should return JSON data. I am being forced to return XML.
Can anyone give some advice on making this work? Thanks,
Here is the XML being returned from the service:
<read status="test" secure="false">
<password>adm1n</password>
<username>me</username>
</read>
Code:
function loadApp() {
var ds = new Ext.data.Store({
proxy: new Ext.data.ScriptTagProxy({
url: 'http://webservice/TestService',
method: 'post',
params: { username: me, password: 'adm1n' }
}),
reader: new Ext.data.JsonReader({
root: 'data',
id: 'username'
Fields: [
{ name: 'username', mapping: 'username', type: 'string' },
{ name: 'password', mapping: 'password', type: 'string' }
]
})
});
ds.load();
}