问题
I'm trying to migrate from fullcalendar 3.x to 4.x
<select id="ids" name="ids[]" class="form-control" multiple>
<option value="1" selected> Option 1</option>
<option value="2"> Option 2</option>
<option value="3"> Option 3</option>
</select>
<button type="button" id="btn-filter">Apply</button>
In 3.x version the data
parameter inside events
are correctly managed as array:
This is my FIREFOX CONSOLE:
array_ids[]:
0: 1
1: 2
start: 2019-06-01T00:00:00
end: 2019-07-01T00:00:00
Piece of code:
events: {
url: './get-events.php',
cache: false,
type: 'POST',
data: function() { // a function that returns an object
return {
array_ids: $("#ids").val()
};
}
error: function () {
alert('there was an error while fetching events!');
},
},
Now after converting into 4.x with this code:
events: {
url: './get-events.php',
cache: false,
method: 'POST', <--- type -> method
extraParams: function() {
return {
array_ids: $("#ids").val()
};
}
},
my FIREFOX CONSOLE show:
array_ids: 1,2 //as string
See attachment ( array_ids is renamed in this example but the logic is the same)
来源:https://stackoverflow.com/questions/56987425/fullcalendar-migrate-from-3-x-to-4-x-extraparams-doesnt-manipulate-multiple-inp