Send GET request to server1 with Javascript then AjaxAnywhere.getAJAX(server2Url, "someZone")

J

Jimmy

How can I do that? Is it possible to send a server request (i.e. GET)
without refreshing the web page? Using Javascript? Or Ajax (i.e.
AjaxAnywhere)?

Or if there's a way (i.e. using AjaxAnywhere) to send the 1st GET
request without updating any zone to server #1? If so, then I can
send the 2nd GET request to server #2 and update a particular zone in
the web page.

Thanks,
Jimmy
 
T

Thomas 'PointedEars' Lahn

Jimmy said:
How can I do that?

Do what?
Is it possible to send a server request (i.e. GET)
without refreshing the web page?

Yes, it is.
Using Javascript?

Or any other ECMAScript implementation in Web clients.

Yes, one approach to do so is currently referred as AJAX (Asynchronous
JavaScript and XML). Even though the request does not need to be
asynchronous, nor are JavaScript or XML required.

It is not the only approach. Which one you take depends on what you are
trying to achieve. For example, simply getting image data from a Web
server constitutes of a HTTP GET request, too.
(i.e. AjaxAnywhere)?

Never heard of that.
Or if there's a way (i.e. using AjaxAnywhere) to send the 1st GET
request without updating any zone to server #1? If so, then I can
send the 2nd GET request to server #2 and update a particular zone in
the web page.

Are you sure you know what you are writing about?


PointedEars
 
J

Jimmy

Thanks for comment.

In short, can you or where can I find sample of Javascript that does
GET request without refreshing the page?

Thanks,
Jimmy

P.S.

By the way, there is "prototype.js" in our project. Is there pre-
written anything in there we call for this purpose?

http://ajaxanywhere.sourceforge.net/
 
T

Thomas 'PointedEars' Lahn

Jimmy said:
In short, can you or where can I find sample of Javascript that does
GET request without refreshing the page?

As I wrote (and you did not care to quote[1]), that depends on what you
are trying to achieve *exactly*. What are you requesting from the
server and what are you going to do with the response?
By the way, there is "prototype.js" in our project. Is there pre-
written anything in there we call for this purpose?

Yes, but you should dump it anyway and use your own code instead.
See my sig.


PointedEars
___________
[1] http://www.jibbering.com/faq/faq_notes/clj_posts.html
http://netmeister.org/news/learn2quote.html
 
J

Jimmy

I'm trying to send a GET request from server #1 to server #2.

e.g. URL to perform task in server #2
http://server-2:8080/anotherWebApp/task?action=add&user=me&password=passwd

I like to use javascript to send the above GET request (in a test.jsp
of someWebApp.war in server #1) to anotherWebApp in server #2.

Then, I like to hit server #1 from test.jsp (using Ajax?) to update a
zone (testZone) inside test.jsp.

e.g. URL to pick up the latest change in server #1 (Ajax call in
test.jsp)
http://server-1:8080/someWebApp/update?action=refresh&page=test.jsp&zone=testZone

Hope this make the question more clear, thanks again.
Jimmy
 
T

Thomas 'PointedEars' Lahn

Jimmy said:
I'm trying to send a GET request from server #1 to server #2.

Will you *please* quote the least of what you are replying to?
e.g. URL to perform task in server #2
http://server-2:8080/anotherWebApp/task?action=add&user=me&password=passwd ^^^^^^^^
I like to use javascript to send the above GET request (in a test.jsp
of someWebApp.war in server #1) to anotherWebApp in server #2.
[...]
e.g. URL to pick up the latest change in server #1 (Ajax call in
test.jsp)
http://server-1:8080/someWebApp/update?action=refresh&page=test.jsp&zone=testZone
^^^^^^^^
You lose against the Same Origin Policy because the host names are
different.

(Setting document.domain does not work for Gecko's XMLHttpRequest, so a
common second-level domain does not help. And MSHTML does not support
signed scripts [AFAIK].)


PointedEars
 
J

Jimmy

Allow me to ask this question differently ...

Does the web browser allow Ajax to send a GET request (in the
Javascript code inside the JSP) to make a different & remote server?
Or does this GET request can only send back to the server where the
JSP is in? Just wondering if there's any security issue here which
blocking the request to go out.

If the above is true, then ...

1) create zone to update JSP with Ajax in server #1
2) send GET request (using Ajax) to server #1 with Javascript function
inside JSP
3) server #1 recieve request (from browser in this case) then map to
GET request of server #2
3) server #1 send GET request to server #2 (server-to-server GET
request to perform some task on server #2)
4) server #1 get result from server #2 then process it
5) update zone by sending another GET request to server #1

Thanks for comment,
Jimmy
 
J

Jimmy

Allow me to ask this question differently ...

Does the web browser allow Ajax to send a GET request (in the
Javascript code inside the JSP) to make a different & remote server?
Or does this GET request can only send back to the server where the
JSP is in? Just wondering if there's any security issue here which
blocking the request to go out.

If the above is true, then ...

1) create zone to update JSP with Ajax in server #1
2) send GET request (using Ajax) to server #1 with Javascript function
inside JSP
3) server #1 recieve request (from browser in this case) then map to
GET request of server #2
3) server #1 send GET request to server #2 (server-to-server GET
request to perform some task on server #2)
4) server #1 get result from server #2 then process it
5) update zone by sending another GET request to server #1

Thanks for comment,
Jimmy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top