$(".qty").change(function(){
$.each($('.qty'), function(){
var form_data ={
rowid: $('.rowid').val(),
qty: $('.qty').val(),
ajax: '1',
};
alert(form_data);
$.ajax({
url:"<?php echo site_url('cart1/update');?>",
type:'POST',
data: form_data,
async: false,
success: function(data) {
alert(data);
}
});
});
Nabeel_2
0
Newbie Poster
Recommended Answers
Jump to PostPerhaps you'd like to post a question?
Jump to Post$(".qty").each(function(){ var me = $(this); me.change(function() var form_data ={ rowid: $('.rowid').val(), qty: me.val(), ajax: '1', }; alert(form_data); $.ajax({ url:"<?php echo site_url('cart1/update');?>", type:'POST', data: form_data, async: false, success: function(data) {alert(data);} }); }); });
Jump to Postwhat's the markup you're using.
Paste a piece of it and I'll advise accordingly.
Jump to Post<?php if ($cart = $this->cart->contents()): ?> <div class="CSSTable1"> <table> <tr> <td>Product Name</td> <td>Quantity</td> <td>Option</td> <td>Price</td> <td>Remove Item</td> </tr> <?php $count = count($cart); for($a=0;$a<$count;++$a){ $item = $cart[$i]; $i = $a+1; echo '<tr data-id="'.$i.'" data-type="product">'; echo '<td><input type="text" id="'.$i.'.rowid" name="qty" value="'.$item['rowid'].'" maxlength="3" size="5" class="qty" /></td>'; echo '<td>'; if ($this->cart->has_options($item['rowid'])) …
Jump to Postand the javascript would be
$('[data-type=product]').each(function(){ var me = $(this),my_id = me.attr('data-id'); me.find('.qty').change(function(){ var form_data ={ rowid: my_id, qty: $(this).val(), ajax: '1', }; alert(form_data); $.ajax({ url:"<?php echo site_url('cart1/update');?>", type:'POST', data: form_data, async: false, success: function(data) {alert(data);} }); }); me.removeAttr('data-id'); });
All 21 Replies
diafol
steelbrain
10
Newbie Poster
<M/>
commented:
Try not giving the code :P
+10
Nabeel_2
0
Newbie Poster
steelbrain
10
Newbie Poster
Nabeel_2
0
Newbie Poster
steelbrain
10
Newbie Poster
steelbrain
10
Newbie Poster
Nabeel_2
0
Newbie Poster
Nabeel_2
0
Newbie Poster
steelbrain
10
Newbie Poster
Nabeel_2
0
Newbie Poster
steelbrain
10
Newbie Poster
Nabeel_2
0
Newbie Poster
steelbrain
10
Newbie Poster
Nabeel_2
0
Newbie Poster
Nabeel_2
0
Newbie Poster
steelbrain
10
Newbie Poster
Nabeel_2
0
Newbie Poster
Nabeel_2
0
Newbie Poster
Nabeel_2
0
Newbie Poster
Airshow
416
WiFi Lounge Lizard
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.