0
     <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

2
  • 2
    You have your quotes all mixed up Commented Jun 1, 2013 at 20:13
  • please don't forget to mention your framework when you're using one. Commented Jun 1, 2013 at 20:14

1 Answer 1

3

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>";
Sign up to request clarification or add additional context in comments.

3 Comments

cool it worked now i have a problem i added <select></select> tags before and after javascript but it does not have any effect do you have any other ideas
@VicToRSava .. Looks like you are not appending it anywhere in your DOM
i edited the main post , so i want it to look something like <select>options..</select> and i aded select tags before and after javascript code .. but it didnt worked

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.