How to dropdown bind according to this recordHow do JavaScript closures work?How can I upload files asynchronously?How do I check if an element is hidden in jQuery?Event binding on dynamically created elements?How do I remove a property from a JavaScript object?How do I redirect to another webpage?How to check whether a checkbox is checked in jQuery?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?How do I return the response from an asynchronous call?

Examples where existence is harder than evaluation

Why does this pattern in powers happen?

Capturing the entire webpage with WebExecute's CaptureImage

How could a civilization detect tachyons?

Is it possible to do moon sighting in advance for 5 years with 100% accuracy?

Two (probably) equal real numbers which are not proved to be equal?

why it is 2>&1 and not 2>>&1 to append to a log file

Why are thrust reversers not used down to taxi speeds?

How do I give a darkroom course without negatives from the attendees?

What will Doctor Strange protect now?

Why is there a cap on 401k contributions?

Is there an application which does HTTP PUT?

Steganography in Latex

Can radiation block all wireless communications?

How do I calculate my to-hit bonus when using the Great Weapon Master feat?

Is there a reason why Turkey took the Balkan territories of the Ottoman Empire, instead of Greece or another of the Balkan states?

Why is it wrong to *implement* myself a known, published, widely believed to be secure crypto algorithm?

How can it be that ssh somename works, while nslookup somename does not?

Did any early RISC OS precursor run on the BBC Micro?

How can I test a shell script in a "safe environment" to avoid harm to my computer?

Whose birthyears are canonically established in the MCU?

Align a table column at a specific symbol

Is the tensor product (of vector spaces) commutative?

Why did Ham the Chimp push levers?



How to dropdown bind according to this record


How do JavaScript closures work?How can I upload files asynchronously?How do I check if an element is hidden in jQuery?Event binding on dynamically created elements?How do I remove a property from a JavaScript object?How do I redirect to another webpage?How to check whether a checkbox is checked in jQuery?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?How do I return the response from an asynchronous call?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have two loops:



  • table loop: fills the table rows

  • dropdown loop: fills the dropdowns with typeid.data[i].TypeId, add a select in the last dropdown

My dropdown does not fill according to its record and I don't understand why.



 var QuestionId = data[i].QuestionOid;
var fkid = data[i].FkSource;
var selectdata = data[i];
var selectinnerhtml = "<span><select id = "answer" + QuestionId + "" name = "answer" + QuestionId + "" class="answer" + QuestionId + " form-control input-small" > </select></span>";
$.ajax(
type: "GET",
dataType: 'json',
contentType: 'application/json; charset=utf-8',
url: '/MYaPI/EmployeeDetails/' + data[i].TypeId,
success: function(datasa)
var optionhtmls = '<option value="' +
0 + '">' + "--Select--" + '</option>';

$(".answer" + QuestionId).append(optionhtmls);

$.each(datasa, function(j)
var optionhtmls = '<option value="' +
datasa[j].Oid + '">' + datasa[j].Title + '</option>';

$(".answer" + QuestionId).append(optionhtmls);
);

);
var newRows2select = "<tr class='rows'><a href = '' >" +
" <td QuestionCategoryTitle = " + selectdata.QuestionCategoryTitle + " QuestionHeader = " + selectdata.QuestionHeader + " ContentTypeId=" + selectdata.FkSource + " QuestionTypeId=" + selectdata.FkQuestionType + " QuestionOID=" + selectdata.QuestionOid + " CategoryOID=" + selectdata.FkQuestionCategory + " class="question-block"><small style="color:slateblue;font-weight: bolder;display:none">CATEGORY: " + selectdata.QuestionCategoryTitle + ",</small>" +
" <i class="deleteRow fas fa-trash float-right"></i> " +
"<p> " + selectdata.QuestionHeader + "</p>" + selectinnerhtml + " </td></a> "</tr>";
$("#table23").append(newRows2select);


enter image description here










share|improve this question






























    0















    I have two loops:



    • table loop: fills the table rows

    • dropdown loop: fills the dropdowns with typeid.data[i].TypeId, add a select in the last dropdown

    My dropdown does not fill according to its record and I don't understand why.



     var QuestionId = data[i].QuestionOid;
    var fkid = data[i].FkSource;
    var selectdata = data[i];
    var selectinnerhtml = "<span><select id = "answer" + QuestionId + "" name = "answer" + QuestionId + "" class="answer" + QuestionId + " form-control input-small" > </select></span>";
    $.ajax(
    type: "GET",
    dataType: 'json',
    contentType: 'application/json; charset=utf-8',
    url: '/MYaPI/EmployeeDetails/' + data[i].TypeId,
    success: function(datasa)
    var optionhtmls = '<option value="' +
    0 + '">' + "--Select--" + '</option>';

    $(".answer" + QuestionId).append(optionhtmls);

    $.each(datasa, function(j)
    var optionhtmls = '<option value="' +
    datasa[j].Oid + '">' + datasa[j].Title + '</option>';

    $(".answer" + QuestionId).append(optionhtmls);
    );

    );
    var newRows2select = "<tr class='rows'><a href = '' >" +
    " <td QuestionCategoryTitle = " + selectdata.QuestionCategoryTitle + " QuestionHeader = " + selectdata.QuestionHeader + " ContentTypeId=" + selectdata.FkSource + " QuestionTypeId=" + selectdata.FkQuestionType + " QuestionOID=" + selectdata.QuestionOid + " CategoryOID=" + selectdata.FkQuestionCategory + " class="question-block"><small style="color:slateblue;font-weight: bolder;display:none">CATEGORY: " + selectdata.QuestionCategoryTitle + ",</small>" +
    " <i class="deleteRow fas fa-trash float-right"></i> " +
    "<p> " + selectdata.QuestionHeader + "</p>" + selectinnerhtml + " </td></a> "</tr>";
    $("#table23").append(newRows2select);


    enter image description here










    share|improve this question


























      0












      0








      0








      I have two loops:



      • table loop: fills the table rows

      • dropdown loop: fills the dropdowns with typeid.data[i].TypeId, add a select in the last dropdown

      My dropdown does not fill according to its record and I don't understand why.



       var QuestionId = data[i].QuestionOid;
      var fkid = data[i].FkSource;
      var selectdata = data[i];
      var selectinnerhtml = "<span><select id = "answer" + QuestionId + "" name = "answer" + QuestionId + "" class="answer" + QuestionId + " form-control input-small" > </select></span>";
      $.ajax(
      type: "GET",
      dataType: 'json',
      contentType: 'application/json; charset=utf-8',
      url: '/MYaPI/EmployeeDetails/' + data[i].TypeId,
      success: function(datasa)
      var optionhtmls = '<option value="' +
      0 + '">' + "--Select--" + '</option>';

      $(".answer" + QuestionId).append(optionhtmls);

      $.each(datasa, function(j)
      var optionhtmls = '<option value="' +
      datasa[j].Oid + '">' + datasa[j].Title + '</option>';

      $(".answer" + QuestionId).append(optionhtmls);
      );

      );
      var newRows2select = "<tr class='rows'><a href = '' >" +
      " <td QuestionCategoryTitle = " + selectdata.QuestionCategoryTitle + " QuestionHeader = " + selectdata.QuestionHeader + " ContentTypeId=" + selectdata.FkSource + " QuestionTypeId=" + selectdata.FkQuestionType + " QuestionOID=" + selectdata.QuestionOid + " CategoryOID=" + selectdata.FkQuestionCategory + " class="question-block"><small style="color:slateblue;font-weight: bolder;display:none">CATEGORY: " + selectdata.QuestionCategoryTitle + ",</small>" +
      " <i class="deleteRow fas fa-trash float-right"></i> " +
      "<p> " + selectdata.QuestionHeader + "</p>" + selectinnerhtml + " </td></a> "</tr>";
      $("#table23").append(newRows2select);


      enter image description here










      share|improve this question
















      I have two loops:



      • table loop: fills the table rows

      • dropdown loop: fills the dropdowns with typeid.data[i].TypeId, add a select in the last dropdown

      My dropdown does not fill according to its record and I don't understand why.



       var QuestionId = data[i].QuestionOid;
      var fkid = data[i].FkSource;
      var selectdata = data[i];
      var selectinnerhtml = "<span><select id = "answer" + QuestionId + "" name = "answer" + QuestionId + "" class="answer" + QuestionId + " form-control input-small" > </select></span>";
      $.ajax(
      type: "GET",
      dataType: 'json',
      contentType: 'application/json; charset=utf-8',
      url: '/MYaPI/EmployeeDetails/' + data[i].TypeId,
      success: function(datasa)
      var optionhtmls = '<option value="' +
      0 + '">' + "--Select--" + '</option>';

      $(".answer" + QuestionId).append(optionhtmls);

      $.each(datasa, function(j)
      var optionhtmls = '<option value="' +
      datasa[j].Oid + '">' + datasa[j].Title + '</option>';

      $(".answer" + QuestionId).append(optionhtmls);
      );

      );
      var newRows2select = "<tr class='rows'><a href = '' >" +
      " <td QuestionCategoryTitle = " + selectdata.QuestionCategoryTitle + " QuestionHeader = " + selectdata.QuestionHeader + " ContentTypeId=" + selectdata.FkSource + " QuestionTypeId=" + selectdata.FkQuestionType + " QuestionOID=" + selectdata.QuestionOid + " CategoryOID=" + selectdata.FkQuestionCategory + " class="question-block"><small style="color:slateblue;font-weight: bolder;display:none">CATEGORY: " + selectdata.QuestionCategoryTitle + ",</small>" +
      " <i class="deleteRow fas fa-trash float-right"></i> " +
      "<p> " + selectdata.QuestionHeader + "</p>" + selectinnerhtml + " </td></a> "</tr>";
      $("#table23").append(newRows2select);


      enter image description here







      javascript jquery ajax dom-events






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 23 at 7:47









      Brian Tompsett - 汤莱恩

      4,2671339105




      4,2671339105










      asked Mar 21 at 12:47









      Addi KhanAddi Khan

      1617




      1617






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I don't know the jQuery way, however it is easily achievable with plain JavaScript



          var select = document.createElement("select");
          var selectinnerhtml = document.createElement("span");
          selectinnerhtml.appendChild(select);
          $.each(datasa, function(j)

          //create a new option element
          var option = document.createElement("option");

          //set the value attribute
          option.setAttribute("value", datasa[j].oid);

          //fill the HTML tag
          option.value = datasa[j].Title

          //add the option to the select dropdown
          select.add(option);
          );





          share|improve this answer























          • i think its shows wrong result because after we add second dropdown automatically dropdown option bind second one not first

            – Addi Khan
            Mar 21 at 13:03











          • Could you clarify?

            – EsliS
            Mar 21 at 13:05












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55280792%2fhow-to-dropdown-bind-according-to-this-record%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I don't know the jQuery way, however it is easily achievable with plain JavaScript



          var select = document.createElement("select");
          var selectinnerhtml = document.createElement("span");
          selectinnerhtml.appendChild(select);
          $.each(datasa, function(j)

          //create a new option element
          var option = document.createElement("option");

          //set the value attribute
          option.setAttribute("value", datasa[j].oid);

          //fill the HTML tag
          option.value = datasa[j].Title

          //add the option to the select dropdown
          select.add(option);
          );





          share|improve this answer























          • i think its shows wrong result because after we add second dropdown automatically dropdown option bind second one not first

            – Addi Khan
            Mar 21 at 13:03











          • Could you clarify?

            – EsliS
            Mar 21 at 13:05
















          0














          I don't know the jQuery way, however it is easily achievable with plain JavaScript



          var select = document.createElement("select");
          var selectinnerhtml = document.createElement("span");
          selectinnerhtml.appendChild(select);
          $.each(datasa, function(j)

          //create a new option element
          var option = document.createElement("option");

          //set the value attribute
          option.setAttribute("value", datasa[j].oid);

          //fill the HTML tag
          option.value = datasa[j].Title

          //add the option to the select dropdown
          select.add(option);
          );





          share|improve this answer























          • i think its shows wrong result because after we add second dropdown automatically dropdown option bind second one not first

            – Addi Khan
            Mar 21 at 13:03











          • Could you clarify?

            – EsliS
            Mar 21 at 13:05














          0












          0








          0







          I don't know the jQuery way, however it is easily achievable with plain JavaScript



          var select = document.createElement("select");
          var selectinnerhtml = document.createElement("span");
          selectinnerhtml.appendChild(select);
          $.each(datasa, function(j)

          //create a new option element
          var option = document.createElement("option");

          //set the value attribute
          option.setAttribute("value", datasa[j].oid);

          //fill the HTML tag
          option.value = datasa[j].Title

          //add the option to the select dropdown
          select.add(option);
          );





          share|improve this answer













          I don't know the jQuery way, however it is easily achievable with plain JavaScript



          var select = document.createElement("select");
          var selectinnerhtml = document.createElement("span");
          selectinnerhtml.appendChild(select);
          $.each(datasa, function(j)

          //create a new option element
          var option = document.createElement("option");

          //set the value attribute
          option.setAttribute("value", datasa[j].oid);

          //fill the HTML tag
          option.value = datasa[j].Title

          //add the option to the select dropdown
          select.add(option);
          );






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 21 at 12:54









          EsliSEsliS

          938




          938












          • i think its shows wrong result because after we add second dropdown automatically dropdown option bind second one not first

            – Addi Khan
            Mar 21 at 13:03











          • Could you clarify?

            – EsliS
            Mar 21 at 13:05


















          • i think its shows wrong result because after we add second dropdown automatically dropdown option bind second one not first

            – Addi Khan
            Mar 21 at 13:03











          • Could you clarify?

            – EsliS
            Mar 21 at 13:05

















          i think its shows wrong result because after we add second dropdown automatically dropdown option bind second one not first

          – Addi Khan
          Mar 21 at 13:03





          i think its shows wrong result because after we add second dropdown automatically dropdown option bind second one not first

          – Addi Khan
          Mar 21 at 13:03













          Could you clarify?

          – EsliS
          Mar 21 at 13:05






          Could you clarify?

          – EsliS
          Mar 21 at 13:05




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55280792%2fhow-to-dropdown-bind-according-to-this-record%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현