summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichal Rezler <rezlemic@fel.cvut.cz>2011-03-26 13:24:46 +0100
committerMichal Rezler <rezlemic@fel.cvut.cz>2011-03-26 13:24:46 +0100
commit3044fa04f4879fe194de48009c13d119ac7782a5 (patch)
tree18cc76d05bd26a79ce93e9257ad6be8ca8f6e306 /lib
parent80997d21e0aee9b8f27153000742ecd781f429f8 (diff)
downloadrpg-3044fa04f4879fe194de48009c13d119ac7782a5.tar.gz
rpg-3044fa04f4879fe194de48009c13d119ac7782a5.tar.bz2
using POST instead of GET in searching by ajax
Diffstat (limited to 'lib')
-rw-r--r--lib/scripts/ajax.js30
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/scripts/ajax.js b/lib/scripts/ajax.js
index ac634fa2c..fe93502cb 100644
--- a/lib/scripts/ajax.js
+++ b/lib/scripts/ajax.js
@@ -4,16 +4,15 @@
* @license GPL2 (http://www.gnu.org/licenses/gpl.html)
* @author Andreas Gohr <andi@splitbrain.org>
* @author Adrian Lang <lang@cosmocode.de>
- * @author Michal Rezler <m.rezler@centrum.cz>
+ * @author Michal Rezler <m.rezler@centrum.cz>
*/
-(function ($) {
+ (function ($) {
var init, clear_results, onCompletion;
var ajax_quicksearch = {
inObj: null,
outObj: null,
- sackObj: null,
delay: null,
};
@@ -26,21 +25,24 @@
if (ajax_quicksearch.inObj === null) return;
if (ajax_quicksearch.outObj === null) return;
- // prepare AJAX
- ajax_quicksearch.sackObj = new sack(DOKU_BASE + 'lib/exe/ajax.php');
- ajax_quicksearch.sackObj.AjaxFailedAlert = '';
- ajax_quicksearch.sackObj.encodeURIString = false;
- ajax_quicksearch.sackObj.onCompletion = ajax_quicksearch.onCompletion;
-
// attach eventhandler to search field
ajax_quicksearch.delay = new Delay(function () {
ajax_quicksearch.clear_results();
var value = ajax_quicksearch.inObj.value;
if(value === ''){ return; }
- ajax_quicksearch.sackObj.runAJAX('call=qsearch&q=' + encodeURI(value));
+ $.post(
+ DOKU_BASE + 'lib/exe/ajax.php',
+ {
+ call: 'qsearch',
+ q: encodeURI(value)
+ },
+ function (data) {
+ onCompletion(data);
+ },
+ 'html'
+ );
});
- // attach eventhandler to input field
$(ajax_quicksearch.inObj).keyup(
function() {
ajax_quicksearch.clear_results();
@@ -62,8 +64,7 @@
ajax_quicksearch.outObj.text('');
};
- onCompletion = function() {
- var data = this.response; // 'this' is sack context
+ onCompletion = function(data) {
if (data === '') { return; }
var outObj = ajax_quicksearch.outObj;
@@ -126,5 +127,4 @@
init('qsearch__in','qsearch__out');
});
-}(jQuery));
-
+}(jQuery)); \ No newline at end of file