Hi Luke, > "<li id=\"{$value['Cookbook']['id']}\"><span id=\"countFav\">{$amount} > </span> <span>{$value['Cookbook']['cookbookname']}</span></li>"; > > Everything works fine so far, but now I also wanted to make sure that > the amount of Elements get updated. so I need to update the $amount. > > So what I figured out is that with this line of code I can overwrite > my HTML with the ID in my case amount > > $.post('../dropZone', {cookbook_id: $(this).attr('id'),id:id}, > function (data) { $(amount).html(data)});
the issue is you're replacing entire element with $(amount).html(data), try: $(amount).find('span#countFav').text(data) Also, you should only have one instance of an ID per document, so if you have: "<li id=\"{$value['Cookbook']['id']}\"><span id=\"countFav\">{$amount} </span> <span>{$value['Cookbook']['cookbookname']}</span></li>"; "<li id=\"{$value['Cookbook']['id']}\"><span id=\"countFav\">{$amount} </span> <span>{$value['Cookbook']['cookbookname']}</span></li>"; "<li id=\"{$value['Cookbook']['id']}\"><span id=\"countFav\">{$amount} </span> <span>{$value['Cookbook']['cookbookname']}</span></li>"; That would be invalid, better to use classes. eg: "<li id=\"cookbook{$value['Cookbook']['id']}\"><span class=\"countFav\">{$amount} </span> <span>{$value['Cookbook']['cookbookname']}</span></li>"; hth Jon -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---