I have a simple iron-ajax element like this:
<iron-ajax id="ajax_email"></iron-ajax>
Then later in javascript I add some parameters to the request, one of them being an array:
var request = this.$$("#ajax_email");
request.params.to = "test@test.com";
request.params.subject = "a cool test";
request.params.content = "some content";
var cc = ["test1@test.com", "test2@test.com", "test3@test.com"]
request.params.cc = cc;
request.generateRequest();
I have a simple PHP script that takes all these parameters, but can't figure out how to receive the "cc" array.
If I try with the GET method, iron-ajax generates the querystring like this:
url?cc=test1@test.com&cc=test2@test.com&cc=test3@test.com
instead of
url?cc[]=test1@test.com&cc[]=test2@test.com&cc[]=test3@test.com
So, $_GET["cc"] in PHP only gets the last value of the array, "test3@test.com".
When I try the POST method instead, $_POST is alway empty...
Anyone knows how to pass arrays with iron-ajax?