简体   繁体   中英

Ajax form only submits once - requires page refresh after that

I have a form which submits successfully via ajaxForm();, but only submits once. To get it to submit again, it requires me to refresh the page.

I am trying to allow users to save the form multiple times in one session without refreshing the page, and even put in a auto save function.

Code below:

$(document).ready(function(){
    $('#create-card-process').ajaxForm({
        dataType: 'json',
        success: function(data) {
            if (data.success) {
                alert('You successfully added a new entry with entry_id '+data.entry_id);
                console.log(data);
            } else {
                alert('Failed with the following errors: '+data.errors.join(', '));
            }
        }
    });
});

Solved. A security module being used within the CMS was causing a security conflict when the user submitted duplicate data.

Removing this solves the issue!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM