Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jquery add to array with key

var obj = {};

$.getJSON("displayjson.php",function (data) {
    $.each(data.news, function (i, news) {
        obj[news.title] = news.link;
    });                      
});

// later:
$.each(obj, function (index, value) {
    alert( index + ' : ' + value );
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #jquery #add #array #key
ADD COMMENT
Topic
Name
9+5 =