значения флажков отображаются, но флажки не отображаются - PullRequest
0 голосов
/ 11 ноября 2019

enter image description here

   function getBrand1(id)
 {
      //  alert('Choose brands!');

if(document.getElementById(id).checked)  
{  

   $.ajax({
    url: 'http://localhost/partsanalysis/public/brand/Ajax/'+id,
   type: "GET",
   dataType: "json",
    error: function(data, errorThrown)
      {
          console.log('request failed :'+errorThrown);
      },
   success:function(result) {
     console.log(result);
    // alert(result);


             /*       $.each(result, function(index, value) { 
                    //alert(value); 
                    // $("#brands").html('<input type="checkbox" />'+value ); 
                    var markup = "<tr><td><input type='checkbox' name='brand_id'></td><td>" + value + "</td></tr>";
                    $("#brands").append(markup);


                  }); */

                   $.each(result, function(index, value) { 
                    //alert(value); 
                    // $("#brands").html('<input type="checkbox" />'+value.brand_name ); 
                    var markup = "<tr><td><input type='checkbox' name='brand_id'></td><td>" + value.brand_name + "</td></tr>";
                    $("#brands").append(markup);

                  });



               }
          });
      }     

    else
        {
            $("#brands").html(""); 
        }


    }

посмотреть

                         <table id="brands">
                            <tr><td> 

                                <input type="checkbox"  name="brand_id"></td></tr>

                                </table>

пожалуйста, проверьте мой код, куда я идуневерно, когда один флажок установлен, показывает несколько его флажков, в этом случае при щелчке отображаются значения, но без флажка

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...