📜  ajax 发布表单侦听器按钮 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:19.792000             🧑  作者: Mango

代码示例1
$("button").click(function(e) {
    e.preventDefault();
    $.ajax({
        type: "POST",
        url: "/pages/test/",
        data: { 
            id: $(this).val(), // < note use of 'this' here
            access_token: $("#access_token").val() 
        },
        success: function(result) {
            alert('ok');
        },
        error: function(result) {
            alert('error');
        }
    });
});