JQuery: can I submit values from inputs that aren't in a form?

Posted by Alvaro on Stack Overflow See other posts from Stack Overflow or by Alvaro
Published on 2014-08-19T16:17:24Z Indexed on 2014/08/19 16:19 UTC
Read the original article Hit count: 151

Filed under:
|
|
|

Simple as that: I have some inputs that are rendered inside another form element, but I want to submit then individually.

I tried "serializing" the div that contains them, but it didn't work. Is there an easy way to do this?

My code:

var form = $("#my_div");
var get_data = $(form).serialize();  /* Get #my_div inputs value */
$.get(self.url_form_rendering, get_data,
function (data){
    /* handle server response */
})

Serialize returns "", any ideas that don't involve redesigning the layout to avoid form nesting?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery