Skip to content

Conversation

@matthughes
Copy link

No description provided.

@sjrd
Copy link
Member

sjrd commented Nov 17, 2014

Review by @lihaoyi
ASAICT, this is OK. But I've never actually used this API, so I'm not the best judge.

@lihaoyi
Copy link
Contributor

lihaoyi commented Nov 17, 2014

Could you say something about what this is useful for? I've never used this API either =P

@matthughes
Copy link
Author

It changes the type of the 'xhr.response' field. By default, this is "", so response == responseText. (https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#responseType)

Ajax.get("foo.json", responseType="json").map { xhr => xhr.response // response is JSON here, no need to call JSON.parse }

Ajax.get("foo.xml", responseType="document").map { xhr => xhr.response // response is Document here, no need to parse again }

@lihaoyi
Copy link
Contributor

lihaoyi commented Nov 18, 2014

Looks good to me then

lihaoyi added a commit that referenced this pull request Nov 18, 2014
Add ability to configure response type in Ajax calls.
@lihaoyi lihaoyi merged commit ba9a116 into scala-js:master Nov 18, 2014
Visbone pushed a commit to Visbone/scala-js-dom that referenced this pull request Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants