Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
Noty modal no se cierra en n.close()

La idea es comprobar si una determinada página está disponible cada segundo. Cuando la página esté disponible, quiero mostrar un Noty-modal donde el usuario puede elegir recargar la página actual o cerrar el modal. Yo uso Noty.js v3.1.4.

Código JS

 <script> var n = new Noty({ text: "Website under construction", type: 'alert', layout: 'center', theme: 'bootstrap-v4', modal: 'true', buttons: [ Noty.button("Yes", "btn btn-primary", function () { location.reload(); }), Noty.button("No", "btn btn-primary ml-3", function () { checkAvailability = true; n.close(); })], animation: { open: 'animated fadeIn faster', close: 'animated fadeOut faster' } }); var checkAvailability = true; var timeout = 1000; (function(){ if (checkAvailability) { $.ajax({ url: "https://example.com", type : 'HEAD', success : function(){ //website is available checkAvailability = false; timeout = 30000; // set timeout to 30 seconds, no need to check every second anymore n.show(); }, error: function (){ //website is not available checkAvailability = true; timeout = 1000; } }); } setTimeout(arguments.callee, timeout); })(); </script>

La solicitud de AJAX funciona y en un momento determinado aparece Noty Modal. Ahora, cuando hago clic en 'No', el modal no se cierra. Veo que n.closed cambia de false a true , pero el modal no desaparece. No hay registro en la consola. ¿Alguna idea de lo que está mal?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!