PDA

View Full Version : XML Server Response Using Ajax



mkariti
17 Sep 2011, 10:09 PM
Hi there,
Im trying to get an XML response from the server using Ext.Ajax.
Im able to get the response only if the App is on the server under the same domain.In the API Doc I noticed that inorder to use diff Domains Ill have to use the : Ext.data.ScriptTagProxy. If I need to access the server via the mobile do I need to use this as well or there is another way to get the response from the server?
I will also would like to wrapp the whole app using Phonegap...

Many thanks
mkariti

bharatn
18 Sep 2011, 12:20 AM
Thats correct - to get data from different domain use script tag proxy from client or fetch data on the server

mkariti
18 Sep 2011, 1:39 AM
Hi bharatn,
Many thanks for your confirmation but can you maybe explain how to apply this?
Here is my code:


Ext.regModel('Sun', {
fields: ['timezone', 'sunset', 'civil', 'Coming_Friday']
});

var store = new Ext.data.Store({
model: 'Sun',
proxy: {
type: 'ajax',
url: '',
reader: {
type: 'xml',
record: 'sun'
},
autoLoad: true
}
});

How do I extract the values when using the script tag proxy? Also, what is the tag for? do I need to place it inside the head tag? and what is the callback=someCallback params?


<script src="http://domainB.com/users?callback=someCallback"></script>

Ext.regModel('User', {
fields: ['id', 'name', 'email']
});

var store = new Ext.data.Store({
model: 'User',
proxy: {
type: 'scripttag',
url : 'http://domainB.com/users'
}
});



Many thanks
mkariti

mkariti
19 Sep 2011, 9:41 AM
Hi there,
Does anyone know how to use the script tag proxy or might have a good exmple of it?
Im still abit puzzled about how one must use it. Where does the following tag must go and what does it actually does...I get the main Idea and it seems like a nice trick but can you use an XML response with it or just a json one?
Will appriciate any curmbs of information...:D

<script src="http://domainB.com/users?callback=someCallback"></script>Cheers
mkariti

leelavathi
21 Sep 2011, 9:42 PM
I too have same probelm.. Dont even have example related to this problm :(

gopikumar
10 Nov 2011, 11:18 PM
hi guys,

even i need an example of scripttag.

Did u got any solution.

using scripttag can we access web service that returns xml response.