?
Solved

ajax post not working in safari

Posted on 2012-12-27
4
Medium Priority
?
641 Views
Last Modified: 2012-12-31
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

0
Comment
Question by:rivkamak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 75

Assisted Solution

by:Michel Plungjan
Michel Plungjan earned 500 total points
ID: 38726682
Not enough information to tell you.

What version of jQuery, Safari version/platform, error messages?
0
 
LVL 25

Assisted Solution

by:Kyle Hamilton
Kyle Hamilton earned 500 total points
ID: 38726688
you should include some error handling in your script, at least to marrow down the problem. look up jquery ajax error handling
0
 
LVL 20

Assisted Solution

by:Mark Brady
Mark Brady earned 500 total points
ID: 38726702
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
 
LVL 11

Accepted Solution

by:
mcnute earned 500 total points
ID: 38727093
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

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question