How can the Serialize () parameter and other parameters of the jQuery form be passed to the back end together

When the front end passes parameters to the back end, sometimes the form can be passed directly for convenience

var formData=$("#formid"). serialize(); To uniformly transmit to the back end, which can save a lot of code; However, sometimes, in addition to passing the data of the form, we also have some scattered single parameters, such as var P_ id=$("#p_id"). val();, It also needs to be sent to the back-end action together. At this time, how to combine formdata and P_ The ID is integrated and passed to the back end? And how should the backend receive it?

First: front end sending method:

Second, the receiving method of the back end: task is the instantiation object to receive the form of the front end; Write another string for a single parameter and use the get set method to receive it

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>