jQuery serializeArray() key value pairs

前端 未结 10 1816
無奈伤痛
無奈伤痛 2020-11-28 06:25

I\'m having a bit of trouble serializing a form

10条回答
  •  粉色の甜心
    2020-11-28 06:45

    To get only form inputs where has a value...

    var criteria = $(this).find('input, select').filter(function () {
        return ((!!this.value) && (!!this.name));
    }).serializeArray();
    

    criteria: {name: "LastName", value: "smith"}

提交回复
热议问题