Jquery convert string of one type to string array.....
Posted
by chandru_cp
on Stack Overflow
See other posts from Stack Overflow
or by chandru_cp
Published on 2010-05-12T12:36:24Z
Indexed on
2010/05/12
12:54 UTC
Read the original article
Hit count: 178
jQuery
|string-manipulation
Consider a string which is
{"Table" : [{"Bird" : "Peacock"},
{"Bird" : "Crow"}]}
to this ["Peacock", "Crow"]
in jquery... Is this possible?
EDIT: I am doing this but didnt work...
$(document).ready(function() {
var obj = JSON.parse('{"Table" : [{"Bird" : "Peacock"},{"Bird" : "Crow"}]}');
myarray = [];
$.each(obj.table, function(i, v) {
myarray.push(v.Bird);
});
$("#tags").autocomplete(myarray, {
width: 138,
max: 4,
highlight: false,
multiple: true,
multipleSeparator: " ",
scroll: true,
scrollHeight: 300
});
});
© Stack Overflow or respective owner