Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-01-2010, 07:45 PM   PM User | #1
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,827
Thanks: 9
Thanked 685 Times in 679 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
Ajax script not working on Safari 4 Windows

Evening all

I have a simple AJAX script that runs when a user clicks an "Add to basket" button. The script calls a php file which updates a database to mark the item as sold, and then submits the form to process a payment.

The script works perfectly in FF3.6, IE6/7/8, Opera 9 and Chrome 5. In Safari 4 on XP the script appears to run with no errors and the form is submitted correctly - but the php file is not called.

If I run the php file manually from Safari it's OK.

Any ideas?

Code:
function sellItem(id)
{
loadXMLDoc('/shopfiles/sellitem.php?id=' + id );
document.additem.submit();
}

function loadXMLDoc(url)
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET",url,true);
xmlhttp.send(null);

}
SB65 is offline   Reply With Quote
Old 04-02-2010, 08:55 AM   PM User | #2
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,827
Thanks: 9
Thanked 685 Times in 679 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
By experimentation, if I change the async on xmlhttp.open to false, Safari4 works fine. This isn't really the solution I wanted though, as it's perceptibly although not disastrously slower than running asynchronously.

Last edited by SB65; 04-02-2010 at 09:04 AM..
SB65 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:31 AM.


Advertisement
Log in to turn off these ads.