单击事件上的JQuery并不总是触发?

时间:2018-02-09 09:52:45

标签: javascript jquery ajax

我有以下ajax调用,在点击时触发,但似乎间歇性地工作,我似乎无法查明问题......

它似乎在一分钟内完美运行,而下一次甚至没有注册点击?

<input class="btn btn-success" type="button" value="Assign" id="assignJounrey<?php echo $callID; ?>" name="assignJounrey<?php echo $callID; ?>">
<input class="btn btn-danger" type="button" value="Unassign" id="unassignJounrey<?php echo $callID; ?>" name="unassignJounrey<?php echo $callID; ?>" style="display: none;">

<script>
$(document).ready(function(){
    $('#assignJounrey<?php echo $callID; ?>').unbind().click(function(){
        $.ajax({
            type: 'POST',
            url: 'assign-journey-calls.php?JourneyID=<?php echo $journeyID; ?>&Call=<?php echo $callID; ?>',
            success: function(){
                $("#assignJounrey<?php echo $callID; ?>").fadeOut();
                $("#unassignJounrey<?php echo $callID; ?>").show();
            }
        });
    });
    $('#unassignJounrey<?php echo $callID; ?>').unbind().click(function(){
        $.ajax({
            type: 'POST',
            url: 'unassign-journey-calls.php?JourneyID=<?php echo $journeyID; ?>&Call=<?php echo $callID; ?>',
            success: function(){
                $("#unassignJounrey<?php echo $callID; ?>").fadeOut();
                $("#assignJounrey<?php echo $callID; ?>").show();
            }
        });
    });
});
</script>

我在这里做错了什么吗?

0 个答案:

没有答案