0

I have the following code that works in conjunction with a "value" that is given from data inputted into an input box.

How would I alter this code to just send the data - product_details['id'] without the need for input data?

Example jQuery Code:

    $('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 Button:

 <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>

1 Answer 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");

    });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.