$(".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 PostI'm not too sure what the question is but here are a few observations from a client-side perspective :
- Don't use
async:false
!!! AJAX is fundamentally asynchronous andasync:false
should never have been provided. It is, at best, unreliable.- You can't rely on an arbitrary cart-entry index to identify …
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.