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

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -