$(".sender").click(function () { var pwd = $("#in_pwd").val; var code = $("#code").val; var url = "/reset_pwd"; var xhr = new XMLHttpRequest(); xhr.open("POST", url); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("Content-Type", "application/json"); xhr.onreadystatechange = function () { if (xhr.readyState === 4) { alert('重設成功') }}; var data = { "code": code, "password": pwd }; xhr.send(data); });