Created
November 1, 2011 03:29
-
-
Save kubido/1329804 to your computer and use it in GitHub Desktop.
scrap indonesia province data list from wikipedia, for seed data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// url : http://id.wikipedia.org/wiki/Daftar_provinsi_Indonesia | |
arr = new Array(); | |
// random id from 0 - 5 | |
random_country_id = Math.floor(Math.random() * (5 - 1 + 1) + 1); | |
$('.wikitable.sortable.jquery-tablesorter tr').each(function(i, tr){ | |
td = $(tr).children()[2] | |
name = $(td).text(); | |
if(i < 11){ | |
i = "0"+i | |
} | |
string = 'province_'+i+':<br/> name: "'+ name +'"<br/> country_id: random_country_id<br/><br/>'; | |
arr.push(string); | |
$('body').html(arr.join(" ")) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment