{"action":"opened","issue":{"url":"https://api.github.com/repos/PolymerElements/iron-ajax/issues/58","labels_url":"https://api.github.com/repos/PolymerElements/iron-ajax/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/PolymerElements/iron-ajax/issues/58/comments","events_url":"https://api.github.com/repos/PolymerElements/iron-ajax/issues/58/events","html_url":"https://github.com/PolymerElements/iron-ajax/issues/58","id":88010823,"number":58,"title":"POST with params is treated as GET by PHP","user":{"login":"kirilledelman","id":6539713,"avatar_url":"https://avatars.githubusercontent.com/u/6539713?v=3","gravatar_id":"","url":"https://api.github.com/users/kirilledelman","html_url":"https://github.com/kirilledelman","followers_url":"https://api.github.com/users/kirilledelman/followers","following_url":"https://api.github.com/users/kirilledelman/following{/other_user}","gists_url":"https://api.github.com/users/kirilledelman/gists{/gist_id}","starred_url":"https://api.github.com/users/kirilledelman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kirilledelman/subscriptions","organizations_url":"https://api.github.com/users/kirilledelman/orgs","repos_url":"https://api.github.com/users/kirilledelman/repos","events_url":"https://api.github.com/users/kirilledelman/events{/privacy}","received_events_url":"https://api.github.com/users/kirilledelman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-13T14:14:43Z","updated_at":"2015-06-13T14:14:43Z","closed_at":null,"body":"Hi,\r\nI'm not sure if this would be considered a bug, or merely an unfortunate design decision, but, iron-ajax is a pain to use with POST requests with PHP.\r\n\r\nSending a POST request with data params to my PHP page results in params added to queryString, but not POST body. Despite the fact that request headers' method is correctly set to POST, PHP interprets query string params as $_GET, and $_POST is empty.\r\n\r\nIron-ajax does not provide a way to convert an object to query string via a simple interface, and I have to do this gymnastics for each request:\r\n\r\n\tvar queryParts = [];\r\n\tfor (param in myParams) {\r\n\r\n\t\tvar value = myParams[ param ];\r\n\t\tvar param = window.encodeURIComponent( param );\r\n\r\n\t\tif ( value !== null ) {\r\n\t\t\tparam += '=' + window.encodeURIComponent( value );\r\n\t\t}\r\n\t\tqueryParts.push(param);\r\n\t}\r\n\tajax.method = 'POST';\r\n\tajax.body = queryParts.join('&');\r\n\tajax.generateRequest();\r\n\r\n\r\nI believe it would be better if this was handled this way by default, internally."}}