javascript - Update value of onClick dynamicly -


i'm adding quantity-field orderform adding of item card done way:

        function updatearchive(id,quant) {     jquery.ajax({         type: "post",         url: "' . gbc_plugin_url . '/includes/gb-order.php",         data: { "gbid": id , "qtty": quant },         success: function(data){             alert("' . __('item added successfully!', 'gbcart') . '");         },         error: function(data){              alert("' . __('this item exists!', 'gbcart') . '");         },     }); } 

the quantity of items put cart set "quant", well, here's problem:

the function "updatearchive" started following command:

    <td class="basket"><a href="#" class="gb-button" onclick="updatearchive(125,5); return false;">' . __('auf die bestellliste', 'gbcart') . '</a></td> 

and thing need dynamicly change number "5" in above example.

when insert number in input, number needs appear instead of "5".

try this:

function updatearchive(id) {     var quant = $('input').val();     jquery.ajax({         type: "post",         url: "' . gbc_plugin_url . '/includes/gb-order.php",         data: { "gbid": id , "qtty": quant },         success: function(data){             alert("' . __('item added successfully!', 'gbcart') . '");         },         error: function(data){              alert("' . __('this item exists!', 'gbcart') . '");         },     }); } 

change $('input') preferred class / id.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -