function wap_pay(channel) {
var amount = document.getElementById('amount').value * 100;
var xhr = new XMLHttpRequest();
xhr.open("POST", "/charge", true);
xhr.setRequestHeader("Content-type", "application/json");
xhr.send(JSON.stringify({
channel: channel,
amount: amount
}));
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
console.log(xhr.responseText);
pingpp.createPayment(xhr.responseText, function(result, err) {
console.log(result);
console.log(err);
});
}
}
}
ajax提交例子
最新推荐文章于 2021-08-05 16:13:23 发布