Problem with jQuery Form and Validate plugins
Ok, this is my last resort, as I've been working on this for a while
and am completely stumped. I'm probably just doing something stupid
that I haven't noticed, so maybe a fresh pair of eyes would help.
Essentially my problem is this: on this website I'm developing, users
can submit photos for a monthly contest. I'm using the Lightbox plugin
with prototype and script.aculo.us to display winners from the past
few months, and the Validate and Form plugins for jQuery to display a
form where users upload their pictures. Thus, I have this in the head
of my document:
adds the photo to a directory of uploaded images, and adds the user's
information to a MySQL database, along with a reference to where the
corresponding photo is stored. The whole process works fine, except
when I try to do it with ajaxSubmit. The success function gets fired,
but the script doesn't display any text response from the server, nor
is any information added to the database. The server-side script
(upload.php) is set to echo some sample text no matter how you access
it, so I don't believe that's the problem.
Any help on this would be incredibly appreciated. I can provide a link
to the page too, if necessary.
Can I assume you are using this 3rd party jQuery plugin?
I've never used this plugin before but I can see you're not doing things just like their coding examples so I wonder if that's your problem. Their example binds to the form's submit event and calls ajaxSubmit() within that. So mirror the examples on the plugin's website exactly to get it working.
You should also try using alert() to find out what the value of "data" is in the callback function. But first find out if the ajaxSubmit is even working (you can also stick alert() calls everywhere to find that out too!).
According to the author of the Validate plugin, the submitHandler is where to place an Ajax call, so it's essentially doing the same thing as binding the ajaxSubmit() function to the form submit event.
I do a similar thing with a contact form on a different page of the site, except there's no file upload. That one works just fine, so I don't think using ajaxSubmit() within the validate() function is a problem. Literally EVERYTHING works here too... except for the success callback. I'd give up on this Form plugin, except I don't know how to do the Ajax-like file upload.
|All times are GMT +1. The time now is 01:19 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.