I have this:
<input type="text" name="field1" id="firstField">
<input type="text" name="field2" id="secondField">
<button name="submitButton" data-parameter="">Click</button>
When you click on the button, an EventListener (jQuery.on) calls a function jQuery.ajax() to load another page where the data gets processed.
the data-parameter attribute is the data for $_POST.
So, data-parameter="name1=test" is $_POST["name1"] with a value test
But how do I get the values of the input-fields into this attribute?
And I have more than one form like this. Some contain more fields, some less.
[name="field1"], why is there also aid="firstField"attribute?data-parameterattribute of the button. Because this attribute sets the parameter for the data, sent by $.ajax() 2.sorry, the second id was a typo. I'll correct this. 3.I nearly always add aidto elements