form serialize javascript (no framework)

后端 未结 23 1394
一生所求
一生所求 2020-11-22 16:07

Wondering is there a function in javascript without jquery or any framework that allows me to serialize the form and access the serialized version?

23条回答
  •  太阳男子
    2020-11-22 16:57

    For debugging purposes this might help you:

    function print_form_data(form) {
        const form_data = new FormData(form);
    
        for (const item of form_data.entries()) {
            console.log(item);
        }
    
        return false;
    }
    

提交回复
热议问题