$(this).serialize() — How to add a value?

前端 未结 8 2350
清酒与你
清酒与你 2020-12-02 08:41

currently I have the following:

$.ajax({
    type: \'POST\',
    url: this.action,
    data: $(this).serialize(),
});

This works fine, howe

8条回答
  •  盖世英雄少女心
    2020-12-02 09:31

    firstly shouldn't

    data: $(this).serialize() + '&=NonFormValue' + NonFormValue,
    

    be

    data: $(this).serialize() + '&NonFormValue=' + NonFormValue,
    

    and secondly you can use

    url: this.action + '?NonFormValue=' + NonFormValue,
    

    or if the action already contains any parameters

    url: this.action + '&NonFormValue=' + NonFormValue,
    

提交回复
热议问题