client/js/wikipedia-bin.js
changeset 42 48d825187d67
parent 37 db991a757015
child 44 869410bab434
--- a/client/js/wikipedia-bin.js	Fri Sep 14 10:21:00 2012 +0900
+++ b/client/js/wikipedia-bin.js	Tue Nov 13 11:46:27 2012 +0100
@@ -37,10 +37,15 @@
     this.lang = _opts.lang || "en";
     this.title_icon_$.addClass('Rk-Wikipedia-Title-Icon Rk-Wikipedia-Lang-' + this.lang);
     this.title_$.html(this.search).addClass("Rk-Wikipedia-Title");
+    this.refresh();
+}
+
+Rkns.Wikipedia.Bin.prototype.refresh = function() {
     var _this = this;
-    Rkns.$.getJSON(
-        "http://" + _this.lang + ".wikipedia.org/w/api.php?action=query&list=search&srsearch=" + encodeURIComponent(this.search) + "&format=json&callback=?",
-        function(_data) {
+    Rkns.$.ajax({
+        url: "http://" + _this.lang + ".wikipedia.org/w/api.php?action=query&list=search&srsearch=" + encodeURIComponent(this.search) + "&format=json",
+        dataType: "jsonp",
+        success: function(_data) {
             var _rgxp = new RegExp('('+_this.search.replace(/(\W)/g,'\\$1')+')','gi'),
                 _html = Rkns._(_data.query.search).map(function(_result) {
                 return _this.resultTemplate({
@@ -53,5 +58,5 @@
             _this.main_$.html(_html);
             _renkan.resizeBins();
         }
-    );
+    });
 }
\ No newline at end of file