PolymerElements / iron-ajax

Easily make ajax requests
https://www.webcomponents.org/element/PolymerElements/iron-ajax
127 stars 113 forks source link

ajax isn't parsed with sync property set #295

Open davidmaxwaterman opened 6 years ago

davidmaxwaterman commented 6 years ago

Description

I was trying to solve a problem on mobile safari where, in response to a button press, I need to synchronously load some json and then set the src on an audio element. It has to be synchronous on mobile safari: (https://stackoverflow.com/questions/24690258/html5-audio-tag-cannot-raise-event-canplay-on-mobile) The json file is loaded fine without the sync property set, and the json is parsed so that currentTarget.lastResponse is a javascript object. Setting the sync property on the iron-ajax element stops it being parse, so I now have to parse it myself. That is unexpected.

Expected outcome

Json is parsed inside iron-ajax, just as when asynchornous.

Actual outcome

A string of json is returned.