ajax post not working in safari

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

rivkamakAsked:
Who is Participating?
 
mcnuteConnect With a Mentor 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.
0
 
Michel PlungjanConnect With a Mentor IT ExpertCommented:
Not enough information to tell you.

What version of jQuery, Safari version/platform, error messages?
0
 
Kyle HamiltonConnect With a Mentor Data ScientistCommented:
you should include some error handling in your script, at least to marrow down the problem. look up jquery ajax error handling
0
 
Mark BradyConnect With a Mentor Principal Data EngineerCommented:
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?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.