From c4e2194fe0e0b4f08fbc194f2ceb0b48e7cab22d Mon Sep 17 00:00:00 2001 From: Kim Lindhardt Madsen Date: Fri, 7 Jul 2017 12:31:17 +0200 Subject: [PATCH] wyc_method Allow other request methods on wyc POST is not that well suited for getting data from the server. GET would be better. Xonomy will still default to POST requests, but can now be told to make GET requests. --- xonomy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xonomy.js b/xonomy.js index 909e5d0..7d25568 100755 --- a/xonomy.js +++ b/xonomy.js @@ -1015,11 +1015,11 @@ Xonomy.pickerMenu=function(picklist, defaultString){ Xonomy.wycLastID=0; Xonomy.wycCache={}; -Xonomy.wyc=function(url, callback){ //a "when-you-can" function for delayed rendering: gets json from url, passes it to callback, and delayed-returns html-as-string from callback +Xonomy.wyc=function(url, callback, method){ //a "when-you-can" function for delayed rendering: gets json from url, passes it to callback, and delayed-returns html-as-string from callback Xonomy.wycLastID++; var wycID="xonomy_wyc_"+Xonomy.wycLastID; if(Xonomy.wycCache[url]) return callback(Xonomy.wycCache[url]); - $.ajax({url: url, dataType: "json", method: "POST"}).done(function(data){ + $.ajax({url: url, dataType: "json", method: method || "POST"}).done(function(data){ $("#"+wycID).replaceWith(callback(data)); Xonomy.wycCache[url]=data; });