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

Capture and play voice with Asterisk ARI -

c++ - Can not find the "fiostream.h" file -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -