当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Ajax fire by checkbox

问题描述:

I am facing a great problem . I am working on a project..Online food booking..In this project I want to add menu and their price by selecting their corresponding checkbox..I want to fire ajax when one checkbox is checked. How can I fire Ajax on checkbox checking?

网友答案:

You only need to use the "change" function in your checkbox to trigger the function that you want, like this:

<script>
jQuery(document).ready(function($) {
    $('#your-checkbox').change(function(e) {
        /* Your ajax call goes here */
    });
});
</script>
分享给朋友:
您可能感兴趣的文章:
随机阅读: