Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

AJAX not working in Safari

 
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have got this simple script to work in
IE7
IE6
Firefox pc
Firefox mac
Opera PC
Chrome PC

but not in safari. It's driving me mad. Any pointers?



The onreadystatechange is not getting called in safari.
 
Sheriff
Posts: 6631
1254
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to instantiate the xml http object with "Msxml2.XMLHTTP" ActiveX object.
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks but that didn't work!
 
Marshal
Posts: 67430
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course not. That's for IE.

Is the sever-side resource getting called? What other debugging steps have you taken?

And why aren't you using jQuery or Prototype or any of the other useful libraries to do Ajax for you? They take care of any browser differences.
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, when using a plain servlet with the code I can get it to work in safari.

I have tried to set up this with wicket framework and it seams that safari can not find the resource but all other browsers can. So now I'm building a servlet
for upload instead. Need progressbar
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've try the code you've posted. It works Okay with all the browsers. The problem seems to be some "Javascript" outside your code may go wrong. It may not due to the assignment of "url" to variable "u" without declaring "u" as local variable. But it may course problem if you use the variable "u" somewhere outside the block.
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a problem for safari and opera as well.

What I really trying to do is to make and multipart upload. and when the upload is started on the onsubmit I'm checking a ajax request. This is not the same way as posting with ajax because this will not work.
However, it seams that the responsiveness of the browsers stops. (in safari, opera. Not in IE ) So the only way is using an Iframe to get it to work with all browsers

 
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic