aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Problem in implementting Ajax on Safari2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Problem in implementting Ajax on Safari2" Watch "Problem in implementting Ajax on Safari2" New topic
Author

Problem in implementting Ajax on Safari2

Kushagra Bindal
Ranch Hand

Joined: Oct 15, 2008
Posts: 156
Hi All,

Safari 2 is not able to handle the Ajax call. Can any one please suggest me to handle the case.

Thanks
Kushagra
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
What is "the AJAX call"? Show us the code you're using.

Also, you might want to read Dynamic HTML and XML: The XMLHttpRequest Object if you haven't done so already.
Kushagra Bindal
Ranch Hand

Joined: Oct 15, 2008
Posts: 156
I have implement AJAX on my jsp page and I am refreshing the my page on the basis of particular requirement.

Its working fine for Window but in Mac for Safari version 2.0.4 its not wqorking fine.
its Server status is returning"undefined"(200 for of condition).

but the readstatus is showing 4 which is ok.

Now what should I do.

Thanks
Kushagra
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
its Server status is returning"undefined"(200 for of condition).

Are you saying that the response is complete, the server response code is 200, but that the text returned form the server is not what you expected? If so, it's a server problem; make sure it serves what you expect it to serve.

If you mean something else, please be more elaborate: TellTheDetails. As I said, seeing the JavaScript code would help diagnose this.
Kushagra Bindal
Ranch Hand

Joined: Oct 15, 2008
Posts: 156
Hi,

Actually on the server itself call not reached.

Thats why I think problem is coming.

Thanks
Kushagra
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

Please take the time to choose the correct forum for your posts. This forum is for questions on JSP.

For more information, please read this.

This post has been moved to a more appropriate forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

You'll need to show us your code. I've been making Ajax calls on Safari for years with no issues.

Be sure to use code tags when posting code.
Kushagra Bindal
Ranch Hand

Joined: Oct 15, 2008
Posts: 156








Here the url I am using is the relative URL. On searching the internet some one says that Safari will not work for relative URL. But at the same time I have applied it for absolute URL but still giving the same error.

Please suggest me the solution and problem in this code.

Thanks
Kushagra
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
For starters, put in proper error handling. This is not a good idea:

catch(e)
{}

How will you know if there is a problem?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Bear and I always recommend that you use a JavaScript library to make your Ajax calls. Than you do not have to deal with the browser quirks.

But in your case have you seen what the status is?



Eric
Kushagra Bindal
Ranch Hand

Joined: Oct 15, 2008
Posts: 156
Hi,

Ya for the first time request status is coming as"undefined" and so it is not going int he if loop might be that will be the problem.

But there is one more problem. Actually in my code I have to check for session for every 1sec and due to this reason in the else I put a call for the setTimeOut("function{calc();}",1000) function of the javascript. And for that reason I want to show you one more code that I implemented mean while.



This is the code that I implements after the past discussion in the forum.
In that code its working fine for IE and firefox on window but for Mac Safari its not working at all.

If in req.open("GET", url, false) I put here false instead of true so it became sync call and in that case first time it goes in the showStatus() function but as it will get false it will never come again in the showStatus() function.


Please suggest me the possible solution for the same.

Thanks
Kushagra
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

Actually in my code I have to check for session for every 1sec

EVery second? Why? What possible use could this be?
Kushagra Bindal
Ranch Hand

Joined: Oct 15, 2008
Posts: 156
Actually this is the requirement of my project as I am using JWS and swing so it will not possible from Swing end to refresh the page. And I have to refresh the page so due to that reason I use Ajax on Page which will check the session value which will check for a flag which I am updating as soon as functioning of Swings over and when it finds any changes in flag as'true' it will goes in the showStatus() function and goes in the if loop and submit the page and then refesh the page. Due to that reason I have to check for the session and due tio that I am calling Ajax hit in each and every second.

As I already told that its working fine for Window OS but creating problem for Mac OS.

Please suggest the possible way to tackle the situation.

Thanks
Kushagra
Kushagra Bindal
Ranch Hand

Joined: Oct 15, 2008
Posts: 156
Hi All,

This code is working fine for safari 3 and higher version but for version 2 its not working.

Is there a specific reason for the same. Also might be stTimeout() is not calling properly for safari 2 version

Please suggest.

Thanks
Kushagra
Kushagra Bindal
Ranch Hand

Joined: Oct 15, 2008
Posts: 156
Is there a solution for the same.

Thanks
Kushagra
 
Consider Paul's rocket mass heater.
 
subject: Problem in implementting Ajax on Safari2