jquery-form/form

"data" option not sending through arrays

amhassen97 opened this issue · 0 comments

Description:

Hi

I am appending data to the ajax form when constructing the options object, The data I am appending is an array or object, which is linked to a key in the data object,

Expected Behavior:

The appended array or object used with the "data" property in the form options gets sent through to the backend.

Actual behavior:

This only works in some cases. If I append a string, the values go through fine, The issue seems to only occur with arrays and objects.

For example:

var formOptions = { beforeSubmit: validateRequest, // pre-submit callback success: showResponse, // post-submit callback error: showError, dataType: "json", data: {chosenPos : selectedPos, chosenNotifs : selectedNotifs}, resetForm: false, }
selectedPos and selectedNotifs are arrays or objects with global scope. This has worked before, but for some reason now does not seem to. It is not consistent.

Thanks for the great library!

Versions:

jquery-form: 4.3.0
jQuery: 3.5.1