jQuery的按钮单击事件不触发单击、按钮、事件、jQuery

由网友(似风没有归宿)分享简介:似乎是一个简单的问题,但解决的另一个问题似乎没有从我的工作。seems like a simple issue but the solutions to the other problem don't seem to work from me.试图触发一个按钮点击一个Ajax请求,但它似乎并没有被解雇。Tryin...

似乎是一个简单的问题,但解决的另一个问题似乎没有从我的工作。

seems like a simple issue but the solutions to the other problem don't seem to work from me.

试图触发一个按钮点击一个Ajax请求,但它似乎并没有被解雇。

Trying to trigger a AJAX request from a button click but it doesn't seem to be firing.

例如HTML

<button class="remove_weight_button" id="15">x</button>

的javascript

javascript

$(".remove_weight_button").click(function(){
    var button_id = $(this).attr("id");
    $.ajax({
        type: "POST",
        url: "weight_tracker_process.php",
        data: {
            weight_id: button_id,
            action: "remove"
        },
        success: function(){
            getWeightData();
        },
        error: function(){
            alert("data removal error");
        }
    });
    return false;
});

推荐答案

在code你能正常工作在拨弄。是您的按钮被通过AJAX后的初始页面加载动态呈现?

解决方案

使用

Use

而不是

$(".remove_weight_button").click(function(){
阅读全文

相关推荐

最新文章