jQuery AjaxSubmit always triggers error (but still submitting)

693 Views Asked by At

I use jQueryForm plugin to submit my forms. I have it in CodeIgniter, so when I submit the form, it runs callback to check for duplicated. If there is one, it loads a view with header 401, if there isn't any - loads normal view.

I used this code for JS:

        function submitDeveloper() {
        $('form#addDeveloper').submit(function() {

            function getDevelopers() {
                $('li.gameDeveloper select').load(window.location + ' li.gameDeveloper select > *', function() {
                    $('.black, .addContent').fadeOut('fast');
                })
            }

            $(this).ajaxSubmit({
                error: function() {
                    alert('Developer już jest w bazie!')
                },
                success: getDevelopers
            })

            return false;
        })
    }

Now it triggers error all the time, but the data is still being submitted. Funny thing is, I have other function, which is almost the same, and it works. The only difference is, I am using beforeSubmit there, but here I don't see any point in this.

What can this be?

0

There are 0 best solutions below