-
28 Aug 2009 11:52 AM #1
Can I make an ajax call to another server?
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); } });dlbjr - David L. Bryant Jr.
Owner of
dlbjr Technology Consulting
Web2 System Developer & Consultant
Focused on C.I. - Six Sigma - Shingo - Lean Technologies
dlbjr.consulting@gmail.com
Owner of:
Attractive Graphics - "custom screen printing"
attractivegraphicscsp@gmail.com
-
29 Aug 2009 3:04 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 44
You could use a ScriptTagProxy (or the cross-domain Ext.Ajax user extension).
But be aware of the requirements for ScriptTagProxy (read the API docs carefully)!
-
29 Aug 2009 5:28 AM #3
Would you have a small example using ScriptTagProxy
Would you have a small example using ScriptTagProxy
Condor:
Would you have a small example please?
dlbjrdlbjr - David L. Bryant Jr.
Owner of
dlbjr Technology Consulting
Web2 System Developer & Consultant
Focused on C.I. - Six Sigma - Shingo - Lean Technologies
dlbjr.consulting@gmail.com
Owner of:
Attractive Graphics - "custom screen printing"
attractivegraphicscsp@gmail.com
-
29 Aug 2009 5:58 AM #4
look to feed-viewer example!
vg Steffen
--------------------------------------
Release Manager of TYPO3 4.5
energlobe.de - german online magazine
-
29 Aug 2009 6:59 AM #5
or the examples/form/custom.html example in your SDK
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
30 Aug 2009 5:13 AM #6
That will work Anomal - Thanks!
That will work Anomal - Thanks!
That will work Animal - Thanks!
dlbjr - David L. Bryant Jr.
Owner of
dlbjr Technology Consulting
Web2 System Developer & Consultant
Focused on C.I. - Six Sigma - Shingo - Lean Technologies
dlbjr.consulting@gmail.com
Owner of:
Attractive Graphics - "custom screen printing"
attractivegraphicscsp@gmail.com
-
30 Aug 2009 5:28 AM #7
What I usually do, for a variety of reasons, is to send all of the calls to one server, and if that server needs to "ask for help from someone else," then let it be the one to do it.
The basic reason for this is ... timing. If you've got several different asynchronous request streams going on at the same time to different servers, then you can lose control of what's going on in a great big hurry. This creates software that's very, very difficult to debug ... stuff that's going to "fail in front of the end-user." Not what you want.
Also... it's usually the case that the host-side components need to be aware of each other. They probably need a reliable, trustworthy way for "the left hand to know what the right hand is doing." Well, the client-side is neither reliable nor trustworthy.
So... let there be a "single point of contact" for the client-side application to talk to. If there needs to be communication among server-side components, let them securely discuss things among themselves without further involving the client.
It's not a matter of "is it possible to do it this-way or that." (The answer is, "yes.") It comes down to what is most likely to be most "RASS = Reliable, Available, Secure, Serviceable."
-
31 Aug 2009 9:01 AM #8
Needing ScriptTagProxy to return XML
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(); }dlbjr - David L. Bryant Jr.
Owner of
dlbjr Technology Consulting
Web2 System Developer & Consultant
Focused on C.I. - Six Sigma - Shingo - Lean Technologies
dlbjr.consulting@gmail.com
Owner of:
Attractive Graphics - "custom screen printing"
attractivegraphicscsp@gmail.com
-
31 Aug 2009 10:57 AM #9
If you had taken Condor's advice you would realize that XML cannot be used.
The name ScriptTagProxy gives a hint, and the documentation makes it explicit.
A <script src="http://webservice/TestService?username=me&password=admin"></script> tag is added to the page.
That's how you can talk to a "foreign" site.
So obviously, as the documentation says, what must be returned is executable Javascript. Calling, as the documentation says, the specified callback function to inject the data into Ext.Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642


Reply With Quote