jQuery dynamic form submit twice -


i have tried create form dynamically , submit on server, data list of $(<checkbox>).

$('<form>').attr("method", "post")            .attr('action', '/proceed')            .append(data)            .submit(); 

the problem on server comes 2 requests: post data , without data -just empty form.

submit happens once, have tried unbind submit before.

the default action of <button /> submit form when it's clicked.

as mentioned in comment, need cancel submission before create own;

 $('.activateeventbutton').on('click', function (e) {       activateevents();        e.preventdefault(); // prevent submission.  }); 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -