funny behavior of jquery code

Posted by user253530 on Stack Overflow See other posts from Stack Overflow or by user253530
Published on 2010-04-01T01:44:56Z Indexed on 2010/04/01 1:53 UTC
Read the original article Hit count: 442

Filed under:
|
|

Funny thing is that if i delete the comment for alert(data[i].id) the code works. As it is in the example, the string is not concatenated thus i have no options in the select box. Hints? Help?

    var bookmarkingSites = '';

        $.getJSON("php/socialbookmark-get-bookmarking-sites.php",function(data){

            for(var i = 0; i < data.length; i++){
                //alert( data[i].id);
                bookmarkingSites += '<option value = \"' + data[i].id + '\">' + data[i].title + '</option>';
            }
        });
<some more code>
-------> toAppend += '<td><select name="sb2" id="sb2">'+
        '<option value="'+ data.results[i].bookmark +'">' + data.results[i].bookmark +'</option>' +
        bookmarkingSites + '</select></td>';
<some more code>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript