I'm trying to use jquery.post to pass a parameter items
with an Array
as its value to the server. Like this:
HTML:
总共 <span class="statistics" data-fields="Record_entries_count"></span> 条记录,
总共 <span class"statistics" data-fields="drop_count"></span> 次。
Javascript:
this.items = this.element.find('span.statistics').toArray().map(i=>$(i).data('fields'));
$.post('backend_server', {"items": this.items}, function(data, status, xhr){...});
However, strangely enough it doesn't get passed correctly. I used the developer's tool to check the request header and found that what I passed as items
becomes items[]
.
Why is this? Could someone please give a hint? Thanks a lot.