VicToR Sava
VicToR Sava

Reputation: 101

JavaSCript Selecting

     <select>
<script type="text/javascript">     
    $.get(     
      'http://www.ufilme.ro/api/load/maron_online/470',     
      function(data){     
        var mydata = new Array();     
        var i = 0; // индекс массива материалов
        $('name', data).each(function(){     
          if($(this).text()=='MATERIAL_ID') mydata[i++] = new Array(); // массив материалов
          mydata[i-1][$(this).text()] = $(this).next().text();     
        });
        var htm = '';
      for(i in mydata) htm += "<option value=\"" + mydata[i]['TITLE'] + "\">"
    + mydata[i]['TITLE'] + "</option>";
        $('#real').html(htm);
      },     
      'xml'     
    );
</script>
</select> 

ok problem 1 resolved now i want it to da like a selection .. and i added but it does not have any effect

Upvotes: 0

Views: 73

Answers (1)

Explosion Pills
Explosion Pills

Reputation: 191729

That's because it's not valid syntax, specifically the option value, but also +''" You're missing quotes.

htm += "<option value=\"" + mydata[i]['TITLE'] + "\">"
    + mydata[i]['TITLE'] + "</option>";

Upvotes: 3

Related Questions