generate html select element by previous selected value using jquery

Posted by FredS104 on Stack Overflow See other posts from Stack Overflow or by FredS104
Published on 2014-06-11T15:21:25Z Indexed on 2014/06/11 15:24 UTC
Read the original article Hit count: 388

Filed under:
|
|

i've a first html select element which generate a second html select element using a first Ajax Function and it will work correctly. This second html element will generate my third html select element but when i do this code for generating my third selector it don't work. i'm looking to made it anyone could help me?

here is the code:

$("#SystemNameSelection").on('change',function ()
{
   var SystemName = $("#SystemNameSelection").text();
   if (SystemName === "Value1")
   {
   $.ajax({url:"MyFile1.php",success:function(result)
         {
         $("#MyElementToPutTheSelector").html(result);
         }
      });
   }
   else if (SystemName === "Value2")
   {
   $.ajax({url:"MyFile2.php",success:function(result)
         {
         $("#MyElementToPutTheSelector").html(result);
         }
      });
   }
   else if (SystemName === "Value3")
   {
   $.ajax({url:"MyFile3.php",success:function(result)
         {
         $("#MyElementToPutTheSelector").html(result);
         }
      });
   }
});

Myfile1, Myfile2 and MyFile3 contain three different html select element. I've tried also with the .change() method and it's didn't work too.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html