ajax post not working in safari

rivkamak
rivkamak used Ask the Experts™
on
I have a click function that runs a jquery ajax post.
it works in all browsers except for safari.
what is wrong with this code?
function submitCart () {
$.post(
     "scripts/savecart.asp",
     $("#form1").serialize()
);}

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Michel PlungjanIT Expert
Top Expert 2009
Commented:
Not enough information to tell you.

What version of jQuery, Safari version/platform, error messages?
Kyle HamiltonData Scientist
Most Valuable Expert 2014
Commented:
you should include some error handling in your script, at least to marrow down the problem. look up jquery ajax error handling
Mark BradyPrincipal Data Engineer
Commented:
If you have get an error in Safari then you probably get at least a warning in other browsers. Open developer tools or firebug or whatever you use and check both the console and the network tab while you run the script.  [Ctrl + Shift + i] in google chrome brings up the developer tools. Click on the Network tab and reload the page or submit the form and see the call that goes out and the response. It shouldn't be to hard to figure it out.

Can you give us a link to the problem page?
Commented:
try to write it like so to get some error information:

$.ajax({
				url: 'scripts/savecart.asp',
				data: $("#form1").serialize(),
				error: function (XMLHttpRequest, textStatus, errorThrown) {
					console.log(textStatus+' '+errorThrown);
				},
				success: function(data) {
					console.log(data); // or if you're not using chrome or firebug alert(data);
				}
				});

Open in new window


This will give you at least an error handling code like 500, 404 or 302 or similar.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial