简体   繁体   中英

form.serialize() doesn't send all values in the Ajax $.post()

I'm getting all the values from a form using serialize() and send them through a Ajax call using $.post() as follow:

$('button#btnBuscar').on('click', function (ev) {
    ev.preventDefault();

    $.post('someRoute', $('#buscadorNorma').serialize(), 'json')
            .done(function (data, textStatus, jqXHR) {
                console.log(data.entities);
            })
            .fail();
});

After click the submit button I check the POST data (in Firebug) send ​​to the route and I notice that only the last parameter was taken in this case comite_tecnico but what about the rest of them? Even if have values isn't send at all, why? I leave a fiddle for testing purpose, can I get some help?

This is a image showing the results:

在此处输入图片说明

Note: for check the POST data use Firebug or any other tool!

name属性添加到您的输入元素中,如下所示:

<input type="text" id="codigo_norma" name="codigo_norma" class="form-control">

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