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

199
Views
La solicitud GET funciona en desarrollo, no en producción

He escrito el siguiente script que debería ejecutar una solicitud GET a una URL específica cuando un conjunto de casillas de verificación están marcadas y desactivadas. Funciona perfectamente localmente pero en Producción, recibo una respuesta 404.

¿Alguna idea de por qué y cómo solucionarlo?

 /** * Remove all child nodes from an element * @param {Object} element The element to empty */ function empty (element) { var children = Array.prototype.slice.call(element.childNodes); children.forEach(function (child) { element.removeChild(child); }); } function toggleItem(toggler, itemType, itemUrl, itemState, itemSource) { let outputDiv = toggler.parentNode.querySelector('.theme-park-item-toggler-output'); empty(outputDiv); let xhr = new XMLHttpRequest(); xhr.open('GET', itemUrl); xhr.send(null); xhr.onreadystatechange = function () { if (xhr.readyState === 4) { // 4 means "Done" if (xhr.status === 204) { // 204 means processed successfully with no content returned console.log('success'); if (itemState == true) { let img = document.createElement('img'); img.src = itemSource; outputDiv.appendChild(img); } } else { console.log('Failure to toggle'); toggler.toggleAttribute('checked'); } } }; } document.addEventListener("turbo:load", function() { document.querySelectorAll('.theme-park-item-toggler').forEach(function(the_toggler) { the_toggler.addEventListener('change', function(e) { toggleItem(the_toggler, the_toggler.dataset.type, the_toggler.dataset.url, e.target.checked, the_toggler.dataset.source); }); }); });
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!