jeudi 8 octobre 2015

Javascript statement executes 1st time, 2nd time it does not

I use this code to remove a selected row from a table, If i choose accept and the variables do not equal each other the "else" statement executes, if they are alike the "if" statement executes. The problem i have is that if i leave the page and create the data that populates the table, then return to the table and attempt to select the row i just created the if statement misses,unless i refresh the page first. Basically the table is a challenges that players created, and obviously a player can not accept a challenge that he has created him self, this is what this code is trying to determine

// Delete record
$(document).on("click", "." + deletebutton, function () {

    if (name == p_name) {
        alert("You can not select a challenge you created!");

        location.href = '../myaccount.php';
    } else {
        var id = $(this).attr("id");
        if (id) {



            if (confirm("A League Fee of 14% will be deducted from each players  bet amount. This fee is non refundable after you accept. Do you really want to Accept this Match ?")) ajax("rid=" + id, "del");
        }
    }
});

Aucun commentaire:

Enregistrer un commentaire