forked from x/volcanos
add some
This commit is contained in:
parent
741d465f0b
commit
23af0374f7
@ -134,9 +134,9 @@ Volcanos("misc", {
|
|||||||
GET: function(can, path, cb) { can.misc.POST(can, can.request({}, {_method: http.GET}), path, {}, function(msg) {
|
GET: function(can, path, cb) { can.misc.POST(can, can.request({}, {_method: http.GET}), path, {}, function(msg) {
|
||||||
cb(msg._xhr.responseText)
|
cb(msg._xhr.responseText)
|
||||||
}) },
|
}) },
|
||||||
POST: function(can, msg, url, form, cb, cbs) { var xhr = new XMLHttpRequest(), begin = new Date(); msg._xhr = xhr
|
POST: function(can, msg, url, form, cb, cbs) { var xhr = new XMLHttpRequest(), begin = new Date(); msg._xhr = xhr, xhr._begin = begin
|
||||||
xhr._begin = begin
|
|
||||||
var data = can.core.ItemForm(form, function(v, i, k) { return k+mdb.EQ+encodeURIComponent(v) }).join("&")
|
var data = can.core.ItemForm(form, function(v, i, k) { return k+mdb.EQ+encodeURIComponent(v) }).join("&")
|
||||||
|
if (can.user.isMailMaster && location.protocol == "http:") { msg._method = http.GET }
|
||||||
if (data && can.base.isIn(msg._method, http.GET, http.DELETE)) { url += (url.indexOf("?") == -1? "?": "&")+data, data = "" }
|
if (data && can.base.isIn(msg._method, http.GET, http.DELETE)) { url += (url.indexOf("?") == -1? "?": "&")+data, data = "" }
|
||||||
xhr.open(msg._method||http.POST, url), xhr.onreadystatechange = function() { if (xhr.readyState != 4) { return }
|
xhr.open(msg._method||http.POST, url), xhr.onreadystatechange = function() { if (xhr.readyState != 4) { return }
|
||||||
try { var res = JSON.parse(xhr.responseText) } catch (e) {
|
try { var res = JSON.parse(xhr.responseText) } catch (e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user