0

我有以下代码与从输入input框中的数据给出的“值”结合使用。

我将如何更改此代码以仅发送数据 -product_details['id']而无需input数据?

示例 jQuery 代码:

    $('body').on("click", "#product_change_set_order_btn", function (e) {
        e.preventDefault();
        var box = $("#product_set_order_box");
        var id = box.data("id"); 

        var url = box.data("url");              
        var data_array = { 
                id : id, 
                new_sort : box.val(), 
            };

        if($.trim(box.val()) != "")
        {
            ajaxCall(url, data_array, null, "product_set_order");

            alert("Your Sort Order Has Been Set");
        }

    });

HTML 按钮:

 <a href="#" class="btn btn-danger" title="Delete <?php echo $product_details['name']; ?>" data-name="<?php echo $product_details['name']; ?>" data-id="<?php echo $product_details['id']; ?>" data-url="admin/PS_products/ajax_product_delete">Delete <?php echo $product_details['name']; ?></a>
4

1 回答 1

1
   $('body').on("click", "#product_change_set_order_btn", function (e) {
        e.preventDefault();
        var box = $("#product_set_order_box");
        var id = box.data("id"); 

        var url = box.data("url");              
        var data_array = { 
                id : id, 
                new_sort : box.val(), 
            };

            ajaxCall(url, data_array, null, "product_set_order");

            alert("Your Sort Order Has Been Set");

    });
于 2013-06-09T23:25:09.677 回答