w1nk5 — 2011-05-05T12:09:49-04:00 — #1
At the page above, at the bottom, there is a button that says "E-mail Seller". This loads a small contact form in a jQuery fancyBox (lightbox).
The following script (form-handler.js) is meant to handle the form to and from the form-handler.php.
var action = $(this).attr('action');
document.getElementById('message').innerHTML = data;
//if(data.match('success') != null) $('#contactform').slideUp('slow');
Everything works fine in Firefox, IE and Chrome. However in Safari, it's like the contents of form-handler.js are not there, its not doing anything. Using Safaris dev tools you can clearly see the script has loaded fine.
Any help would be greatly appreciated.
chris_upjohn — 2011-05-05T19:48:34-04:00 — #2
Personally rather then using return false i would use the following to prevent the form running its normal action event.
That is the only thing i can see that would let the form continue normally.
w1nk5 — 2011-05-05T20:05:16-04:00 — #3
Zing. Unfortunately modifying my code like you suggested did not help. Everything still works fine in all browsers except Safari.
chris_upjohn — 2011-05-05T20:11:30-04:00 — #4
Okay try this
w1nk5 — 2011-05-06T01:32:28-04:00 — #5
That fixed it!!! You da man!
Thanks a lot for you help.
chris_upjohn — 2011-05-06T03:00:59-04:00 — #6
w1nk5 — 2011-05-06T10:49:20-04:00 — #7
Any chance you can help me understand why this works?
chris_upjohn — 2011-05-06T19:50:58-04:00 — #8
When i looked at how your modal window worked i saw Ajax requests which inputted the form that everyone sees, once i saw that i said to use the .live() method because it seeks out DOM elements that are not part of the original DOM structure where as the .submit() method can only seek out DOM elements that are part of the pre-existing DOM.
I had the same trouble when i first started with Ajax and form submissions but after a while you start to understand what works better with Ajax.
w1nk5 — 2011-05-09T09:29:34-04:00 — #9
Awesome. Thanks a lot. I really appreciate your help.