always use XMLHttpRequest

current behavior will use XDomainRequest whenever it is available even though the request is not necessarily CORS. this creates a problem when on certain browsers (e.g. ie10) because:
- Access-Control-Allow-Origin header is expected despite the request not being CORS
- XDR does not have an onreadystatechange function (http://msdn.microsoft.com/en-us/library/ie/cc288060(v=vs.85).aspx) and use of its proper callback functions appear to have not yet been implemented
This commit is contained in:
Pepe Bawagan 2014-06-01 21:44:10 +08:00
parent 5446a39702
commit 16d4eb77c8

View file

@ -453,7 +453,7 @@ Mithril = m = new function app(window) {
function identity(value) {return value}
function ajax(options) {
var xhr = window.XDomainRequest ? new window.XDomainRequest : new window.XMLHttpRequest
var xhr = new window.XMLHttpRequest
xhr.open(options.method, options.url, true, options.user, options.password)
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {