diff --git a/src/scripts/book.tag b/src/scripts/book.tag index 7632e2d..37e8ecc 100644 --- a/src/scripts/book.tag +++ b/src/scripts/book.tag @@ -45,24 +45,31 @@ getresources(ev) { }; var url = "/search/resources"; - $.getJSON(url, { - data : encodeURIComponent(JSON.stringify(params)) - }).done(function(results) { + fetch(url, { + method : "POST", + body : JSON.stringify(params), + headers: { + 'Content-Type': 'application/json' + } + }).then( + function(response) { + if (response.ok) { + return response.json() + } + }).then( + function(results) { if (results.iarchive) { self.iarchive = results.iarchive[0]; } - if (results.openlib) { self.openlib = results.openlib[0]; } - if (!(results.openlib && results.iarchive)) { self.noresources = true; } - self.loading = false; self.update(); - }); + }) } diff --git a/src/website.py b/src/website.py index 04b1ec8..4ad4bf0 100755 --- a/src/website.py +++ b/src/website.py @@ -74,9 +74,8 @@ def ClassSearch(configfile=None): def resources(): """ Get Resources """ notRequired = False - try: - params = loads(unquote(dict(request.args.items())["data"])) - except KeyError: + params = request.json + if params is None: return jsonify(False) print(params) author = params["author"]