jquery-form/form

Incompatible with jQuery 3 slim build

xkovacikm opened this issue · 5 comments

Hey there,

I've got the problem with this package while using Jquery 3.2.1.
function ajaxForm is giving me an error: Cannot read property 'success' of undefined.

Someone on stackoverflow explained it there:
https://stackoverflow.com/questions/45655409/website-using-jquery-form-version-4-2-2-and-jquery-3-

jQuery v3 introduces a lot of sweeping chances: one of which is the removal of the jqXHR.success() callback (it has been deprecated since v1.8, but many authors don't seem to bother to migrate/update). The plugin is obviously not updated to listen to resolution of promise using the jqXHR.done() callback.

Is there any chance to fix this problem?

Thank you ;)

Instructions for Reporting a Bug
Would you please create an example of the error on JSFiddle or CodePen so that others can reproduce the issue you're seeing?

https://jsfiddle.net/v9mrjr7o/2/ (you have to open developer console and then try to submit form)

But in description is already explained what could be wrong.

jQuery v3 introduces a lot of sweeping chances: one of which is the removal of the jqXHR.success() callback (it has been deprecated since v1.8, but many authors don't seem to bother to migrate/update). The plugin is obviously not updated to listen to resolution of promise using the jqXHR.done() callback. Your best best is to revert to jQuery v2 or lower. – Terry Aug 12 '17 at 22:28

Thank you!

I am sorry, my bad.

It's probably not working only with Jquery 3 Slim

Using the JSFiddle you provided, I'm unable to recreate your original error
Cannot read property 'success' of undefined
Instead, I see the following error in my Chrome console:
Uncaught ReferenceError: opciones is not defined at window.onload

If I remove the opciones variable being passed into the ajaxForm() function on line 6, the form 'submits' successfully and displays the JS alert "wow".

Would you please update the JSFiddle to display the Cannot read property 'success' of undefined error?

I am so sorry. That JSFiddle example wasn't properly saved.
https://jsfiddle.net/v9mrjr7o/7/

this one is ok. Sorry once again.