2

I have created a custom popup in list page .. I need to open the popup after 4 sec of every product addtocart.

And auto close the popup after 4 sec.

some time the popup suddenly closed within 4 sec....

How to slove this ...

    $.ajax({
     url: BASE_URL + this.options.posturl,
      type: "POST",
      datatype: "json",
     data: {productId: productId},
      success: function (response) {
       $("#custom-popup").hide();
   if (response['content']) {
    $("#custom-popup").html(response['content']);
         setTimeout(function () {
           $("#custom-popup").show();
          setInterval(function () {
          $("#custom-popup").hide();
          }, 4000);
         }, 4000);

 }
            }
});

Thanks.

  • please check my answer and let me know if any query. – Rohan Hapani Jun 23 '18 at 18:56
  • Your answer is same as my question..what is the change???? @Rohan Hapani – Mahi M Jun 25 '18 at 4:19
  • Remove $("#custom-popup").hide(); at success. – Rohan Hapani Jun 25 '18 at 4:52
  • Can i remove these lines in my code ? setInterval(function () { $("#custom-popup").hide(); }, 4000); – Mahi M Jun 25 '18 at 5:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.