Skip to content

Commit 9569507

Browse files
committed
explicitly accept json in ajax requests
The ajax request is parsing the result as JSON, however this isn't being set in the headers. Firefox adds default headers for text/html, text/xml etc. This means that some frameworks like Laravel, Umbraco etc start to automatically return the data as XML, breaking the typeahead data parsing.
1 parent 740ef06 commit 9569507

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/utils/callAjax.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export default (url, callback)=> {
88
}
99
}
1010
}
11+
httpRequest.setRequestHeader("Accept", "application/json")
1112
httpRequest.open('GET', url)
1213
httpRequest.send()
13-
}
14+
}

0 commit comments

Comments
 (0)