Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Help me with AJAX!

  Asked By: Ella    Date: Sep 10    Category: Java    Views: 531
  

I have a problem in using open() method of XMLHttpRequest, when i send a
ULR to this method and this URL refers to my PC it works , but if this
URL refers to other station of LAN ,I get this error "Permission
denied" . I test this method with other URLs , if it contains "http://"
the method doesn't work and that error occured, but if it doesn't
contain "http://" , no error occurs, but no response is available! I'm a
beginner in AJAX, and I'll be so happy if someone help me! thx :-)

Share: 

 

5 Answers Found

 
Answer #1    Answered By: Waggoner Fischer     Answered On: Sep 10

I think you have no proble in your code .
maybe some thing such as a firewall at server side has blocked
"http access" from the client requsting "oPen()" method.
the "permission denied" message confirms this idea.
make sure there is no mechanism designed at the "server" to filter
request types such as "http" or others.

 
Answer #2    Answered By: Davi Costa     Answered On: Sep 10

Hi frist this is j2ee list not java script list! ;-)
second what is your browser? where are you downloading the page from?
I guess you are downloading page from one computer and sending request to another (like java applets) this is not allowed in AJAX.

"For security reasons, you can't use Ajax to request content from a domain outside of the current one. This is referred to as the Ajax sandbox."


you can open a cross browser object by this code:


if (window.XMLHttpRequest) {
// we have Mozilla, Opera or Safari
xmlhttp = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
// we have IE
try {
xmlhttp = new ActiveXObject(" Msxml2.XMLHTTP");
} catch(e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
xmlhttp = false;
}
}
}

 
Answer #3    Answered By: Sydney Thompson     Answered On: Sep 10

I don't want to fix this problem directly, But I want to suggest you to use frameworks and APIs that would make AJAX easier for you; Your high level requirement is that you need to call a server side method from the client side. So don't confuse yourself with low level APIs when there are some free frameworks for AJAX.
I have used DWR before this(1 year ago) and I was happy with that.
I hope those comments fix your problem indireclty

 
Answer #4    Answered By: Kim Cruz     Answered On: Sep 10

First, thank for your suggestion,I'll check it out, then I found the answer, sending request to another servers or station is not allowed in open() method. Anyway Thx.

 
Answer #5    Answered By: Adelbert Fischer     Answered On: Sep 10

you should know that ajax work with web servers .when you work
with ajax ,you should connecting to a webserver and send your message.
then webserver send response to you.if you have not a web server in
your LAN ajax can not send and recive data.you can recive data from a
web server on WAN(Internet)with http://.test it... because in WAN a
web server is waiting for your request but in your Lan ...NO!
additionally if you have a web server in your LAN ,your web server
should be configure.at last test your firewall ,if you have one of
them.

 
Didn't find what you were looking for? Find more on Help me with AJAX! Or get search suggestion and latest updates.




Tagged: