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

167
Views
Por qué no puedo usar $.ajax

Tengo un problema en mi proyecto. Me gustaría acceder a mi función cuando termine el iframe, pero intento buscar cómo puedo hacer esto, pero todas las soluciones no funcionan, no sé por qué. Mi proyecto tiene plantillas de la aplicación web Asp.Net (.NET Framework).

Script js, cuando cree un iframe e "intente" conectarse a mi función en WebForm1.aspx.cs:

 <script> const tag = document.createElement("script"); tag.id = "iframe-demo"; tag.src = "https://www.youtube.com/iframe_api"; const [firstScriptTag] = document.getElementsByTagName("script"); firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); let player; window.onYouTubeIframeAPIReady = () => { player = new window.YT.Player("player", { width: 500, height: 500, videoId: "M7lc1UVf-VE", events: { onStateChange: window.onPlayerStateChange } }); }; window.onPlayerStateChange = (event) => { if (event.data === 0) { jQuery.ajax({/* * */ method: "POST", url: "/WebForm1.aspx/returnid", error: function (XMLHttpRequest, textStatus, errorThrown) { console.log(textStatus); }, success: function (result) { console.log("success"); } }); } }; </script>

Código de WebForm1.aspx.cs:

 [WebMethod]//[WebMethod()] public static string returnid(string subject, string message, string messageId, string pupilId) { Console.WriteLine("testar"); return "";//https://www.youtube.com/watch?v=8elyZ6aGgZY }

Intento usar $.ajax, ajax, $Jquery allí * y no funciona.1

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Tienes que importar jQuery, agrega esto dentro de la etiqueta del encabezado:

 <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
about 4 years ago · Juan Pablo Isaza Report
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!