You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
368 B
13 lines
368 B
"use strict"; |
|
|
|
function post(url, vals, cb) { |
|
const data = new FormData(); |
|
for (const key in vals) { |
|
data.append(key, vals[key]); |
|
} |
|
const xhr = new XMLHttpRequest(); |
|
xhr.open('POST', url) |
|
xhr.onreadystatechange = function() { if (xhr.readyState === XMLHttpRequest.DONE) return cb(xhr.status, xhr.responseText) }; |
|
xhr.send(data); |
|
} |
|
|
|
|