Thanks for correcting me on ActiveX... I didn't know that internally,
an XMLHttpRequest object gets used in the end.

In response to disccomp, I'm not sure how I would use a relative URL.
Could you give an example?  I've tried using a value such as /MyApp/
MyServlet, but this doens't work at all (even in IE), which I can
understand since this is not specifying exactly how to reach the
servlet.

T.J, thanks for your reply as well.  The answer to your first question
(the URL of the page that this is part of) is that I'm just having an
HTML file sitting on my desktop.  This is the HTML file that I'm
loading up in IE, Firefox, and Chrome.  So it's not part of any web
app, but rather just tries to invoke a servlet on a web app that is
currently deployed.  Would this make a difference?  (If so, how can we
explain why it works on IE?)  In any case, I can and will try to load
an HTML file that is part of the same web app (since that's the
overall intent anyways), but I guess I'm not very confident in this
fixing the issue.

Also, the reason I use 8701 is because I'm trying this at work where
I'm using WebLogic (and the port is set up as 8701), but on my home
machine, I am using tomcat so I use 8080 like you did.

On Mar 15, 4:25 am, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
> Hi,
>
> > From IE, it works just fine
> > (probably because it's using ActiveX rather than XMLHttpRequest)
>
> Not *rather than* -- it's using XMLHttpRequest regardless. On older
> versions of IE, the way you get one is via ActiveX, but that's
> irrelevant (and only older versions); it's an XMLHttpRequest
> regardless.
>
> >      var asyncReq = new Ajax.Request("http://localhost:8701/MyApp/
> > MyServlet", opts);
>
> What's the URL of the page this is a part of? Because the fact you've
> given a full URL there makes me think this is not relative to the
> page, which makes me wonder if you're running afoul of the Same Origin
> Policy[1] (because remember, different ports are different origins).
> But in that case, I wouldn't expect IE to work, either, not even IE6.
>
> When I try this in my setup, requesting from localhost:8080 to
> localhost:8701, using IE7 I simply get an access denied error and my
> servlet (okay, it's a JSP for test purposes) is never triggered at
> all. When I try this from Firefox or Chrome, because they support
> CORS[2][3], I see the OPTIONS request to my JSP seeking permission for
> cross-origin requests.
>
> [1]http://en.wikipedia.org/wiki/Same_origin_policy
> [2]http://www.w3.org/TR/cors/
> [3]https://developer.mozilla.org/En/HTTP_access_control
>
> FWIW,
> --
> T.J. Crowder
> Independent Software Consultant
> tj / crowder software / comwww.crowdersoftware.com
>
> On Mar 12, 2:53 pm, Ronen <rrotst...@gmail.com> wrote:
>
> > I've downloaded the latest prototype (version 1.6.1) and tried to call
> > a java servlet using Ajax.Request.  From IE, it works just fine
> > (probably because it's using ActiveX rather than XMLHttpRequest), but
> > I'm having no luck with Firefox (v3.6) and Chrome (4.0).
>
> > The servlet that I'm calling performs a log operation right away so I
> > can see whether it was called or not.  That's how I know that IE is
> > successful but firefox and chrome aren't.
>
> > I've used Firebug to try to debug firefox and I see that the line
> > this.transport.send(this.body);
> > is, in fact, being called by firefox.  But still, my servlet shows no
> > log of being called.
>
> > The exact javascript I'm using is below:
> >      var opts = {
> >           method: 'post',
> >           parameters : { key:"value" },
> >           onSuccess: function(transport)
> >           {
> >                var d = new Date();
> >                document.getElementById("location").value =
> > d.getTime();
> >           }
> >      }
> >      var asyncReq = new Ajax.Request("http://localhost:8701/MyApp/
> > MyServlet", opts);
>
> > As you can see, in the success method, I just populate a textbox to
> > have the current date/time, and this actually works in all browsers
> > (IE, Firefox, Chrome).  Just that in Firefox and Chrome the servlet is
> > not physically being called (yet the success method is).
>
> > Any help in solving this issue is greatly appreciated.
>
> > --Ronen

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to