But the url need to be added since it is different of the title
Yep, but you can work out the url from the title: ------------------------------ function titleToUrl(title) { var chr, url = ""; for (var i=0; i<title.length; i++) { chr = title.charCodeAt(i); url += (chr == 32 ? "_" : escape(String.fromCharCode(chr))); } return url; }
// quick test: var test_data = ["Roman Catholic Church", "cat (disambig)", ""!@$^&*))(_--{}"]; for (var i=0; i<test_data.length; i++) { document.write(test_data[i] + " equals: " + titleToUrl(test_data[i]) + " <br>\n"); } ------------------------------
Output is: ------------------------------ Roman Catholic Church equals: Roman_Catholic_Church <br> cat (disambig) equals: cat_%28disambig%29 <br> "!@$^&*))(_--{} equals: %22%21@%24%5E%26*%29%29%28_--%7B%7D <br> ------------------------------ (which seems identical to what the Wikipedia gives too).
Don't have to do it this way though, and if you'd prefer to do it on the server side, then do that.
I just thought that transmitting less data and potentially storing less data might help.
Did you used json in EMCAsript/javascript ?
Nah, I just make this stuff up as I go along. ;-)
Should work fine though: ------------------------------ var json_data = eval("["cat",["Catholics", 7505, "Roman Catholic Church"],["Catholic Archibishop", 4484, "Bishop"],["Catholic", 4200, ],["Catholic", 3269, ]["CATV", 2347, "Cable television"],["Catalogue astrographique", 2095, "Star catalogue"],["Catholic Encyclopedia", 1956, ],["Catalonia", 1740, ],["Cattle", 1604, ],["Catholicism", 1527, ]]"); alert("length: " + json_data.length + " data: " + json_data); ------------------------------
I.e. you may have to get rid of the newlines in the data stream.
All the best, Nick.