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

247
Views
Dos llamadas jQuery Ajax en la misma página, una funciona y la otra no

Tengo dos llamadas Ajax en la misma página, la primera funcionó perfectamente, así que la dupliqué y cambié los valores necesarios para que fueran independientes, sin embargo, la segunda llamada Ajax no funciona. Lo probé en una página separada y funciona bien, solo no funciona cuando ambas llamadas están en la misma página, ¿me estoy perdiendo algo?

 jQuery('#lampbase').on('change', function(){ var basevalue = $(this).val(); jQuery.ajax({ url: 'basesfetch.php', method: 'post', data: {basevalue1: basevalue}, success: function(result){ $("#baseresponse").html(result); $( "select" ).on('change',function() { var str = ""; // For multiple choice $( "select option:selected" ).each(function() { str += $( this ).val() + " "; console.log(str); }); }); jQuery('#lampbase').on('change', function(){ $(".lampoptions").fadeIn(); }); jQuery("#lampcolor").change(function(e){ var DefaultOption = $('option:selected', this).data('code'); $("#detailcolor option[data-code='" + DefaultOption + "']").prop("selected", true); $("#lampholder option[data-code='" + DefaultOption + "']").prop("selected", true); $("#lampholder option[data-code='" + DefaultOption + "']").prop("selected", true); $("#FlexColour option[data-code='" + DefaultOption + "']").prop("selected", true); $("#Switch option[data-code='" + DefaultOption + "']").prop("selected", true); }); $("select option").val(function(idx, val) { $(this).siblings("[value='"+ val +"']").hide(); }); } }); }); jQuery('#lampshade').on('change', function(){ var shadevalue = $(this).val(); jQuery.ajax({ url: 'shadefetch.php', method: 'post', data: {shadevalue1: shadevalue}, success: function(result){ $("#shaderesponse").html(result); $( "select" ).on('change',function() { var str = ""; // For multiple choice $( "select option:selected" ).each(function() { str += $( this ).val() + " "; console.log(str); }); }); } }); });

Código HTML:

 <select id="lampbase"> <option value="first">Select</option> <?php $sql = mysqli_query($connection, "SELECT DISTINCT ProductName FROM TableLamps_CSV"); while ($row = $sql->fetch_assoc()){ $productname = $row['ProductName']; echo "<option value=\"$productname\">" . $row['ProductName'] . "</option>"; } ?> </select> <select id="lampshade"> <option value="first">Select</option> <?php $sql = mysqli_query($connection, "SELECT DISTINCT ShapeName FROM shadetable"); while ($row = $sql->fetch_assoc()){ $shapename = $row['ShapeName']; echo "<option value=\"$shapename\">" . $row['ShapeName'] . "</option>"; } ?> </select>
over 4 years ago · Santiago Trujillo
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!