samedi 25 janvier 2020

How to populate the txt data into the select tag as both option value and within option tag

<select id="sel1">select</select>
<script>
$(document).ready(function () {
      $.ajax({
   url:"jsoncategory.txt",
   method:"POST",
   success:function(data)
   {
console.log(data);
    },
   error:function(data){
          console.log(data);
        }
  })
</script>

jsoncategory.txt

Women
Home furniture
TVs & Appliances
Sports,Books & More
Electronics
Men

**Here in this above code, please instruct me, teach me that how to propagate or populate the .txt data into the select tag as both option value and the text within the option tag?, the output should be like for example, Women" **




Aucun commentaire:

Enregistrer un commentaire