Insert Array via chain.js

1 view
Skip to first unread message

Rusco

unread,
Sep 25, 2008, 4:03:20 AM9/25/08
to chainjs
Hi,
I am calling a jsonp webservice in the following way:

$.ajax({
dataType: 'jsonp',
url: 'http://json-time.appspot.com/timezones.json',
success: function (data) {
alert(data.length);
//some more code here .....
},
});

This returns only an array, no hashes:
[
"Africa\/Abidjan",
"Africa\/Accra",
"Africa\/Addis_Ababa", etc.....

Is there a way to inject this into html using chain.js ?

Thanks for your advice
Rusco.

Rizqi Ahmad

unread,
Sep 25, 2008, 11:15:16 AM9/25/08
to chainjs
you can confert them to hashes like this:
var items = $.map(json, function(){
var split=this.split('\/');
return {continent:split[0], country:split[1]};
});

then instert items to chain.

regards, RIzqi
Reply all
Reply to author
Forward
0 new messages