jquery - How find new element on page after ajax response -


i have problem find current html elements after - ajax response , deleted them page.

here jquery code send post , delete element page. after refresh want find element stay in page - dont know why got elements - use callback function.

            function removeproduct(callback) {             var recordchosen = $(this);             var recordtodelete = recordchosen.attr("data-id");               if (recordtodelete != '') {                  // send post request ajax                 $.post("/cart/removefromcart", { "albumid": recordtodelete },                     function (response) {                         // success                               $('#productcart-' + response.prodid).fadeout('slow', function () {                              if (response.productscart == 0) {                                 $("#cartempty").removeclass("hidden");                             }                             callback();                         });                         var textcart = $("#cartbox").text();                         var amountcart = (parseint(textcart) - 1);                         $("#cartbox").text(amountcart);                      });                  return false;              };          };          $(".removeproduct").click(function () {             removeproduct.call(this, updatetotal);         }); 

here avery think ok when callback method start

function updatetotal() {             var $priceelement = $(".products").find('td.customervalue');             var $totalvalue = 0; 

in priceelement have 4 element should 3 because previous delete one.

so do, have in callback method correct element exist after using js delete them page? sorry pure english:)


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -