Hi Friends I am new in jquery and want to learn Ajax I developed a simple code in which i am deleting rows of table and the length of the row will updating in one div you can check fiddle here or you can see me code below
SCRIPT
var len = $('table tr').length;
$('.shopItems').text('items in your cart '+len);
$('.del').click(function(){
var len = $('table tr').length;
var len = len - 1;
$('.shopItems').text('items in your cart '+len);
//alert(len)
if(len == 0)
{
$('table').remove();
$('.empty').show();
}
else{
$(this).parent('tr').remove();
len--;
}
})
HTML
<div class="shopItems"></div>
<div class="empty" >Your Cart is empty</div>
<table width="100%">
<tr>
<td>Image</td>
<td>Discription</td>
<td class="del">X</td>
</tr>
<tr>
<td>Image</td>
<td>Discription</td>
<td class="del">X</td>
</tr>
<tr>
<td>Image</td>
<td>Discription</td>
<td class="del">X</td>
</tr>
</table>
CSS
.empty{display:none;}
My question is can i do this same thing using with Ajax and how please help me.
Thanks in advance....
<div class="shopItems"></div>