diff options
| author | John J. Camilleri <john@digitalgrammars.com> | 2020-07-28 22:19:15 +0200 |
|---|---|---|
| committer | John J. Camilleri <john@digitalgrammars.com> | 2020-07-28 22:19:15 +0200 |
| commit | 22d5f31d7450722e45abe07474469c1e3838fce2 (patch) | |
| tree | 3df5efb31edf6cc854c68142dcbab88afeba085a /src/www | |
| parent | 38f468eed3325d5e435021b8b137f80545f22a95 (diff) | |
| parent | 830dbe760db2df0c573c06cb481d0611bf55908b (diff) | |
Merge remote-tracking branch 'origin/master' into pgf2-hackage
Diffstat (limited to 'src/www')
| -rw-r--r-- | src/www/js/support.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/www/js/support.js b/src/www/js/support.js index 2c7dd782e..e999f8298 100644 --- a/src/www/js/support.js +++ b/src/www/js/support.js @@ -89,7 +89,7 @@ function GetXmlHttpObject(handler) return objXMLHttp } -function ajax_http(method,url,body,callback,errorcallback) { +function ajax_http(method,url,body,contenttype,callback,errorcallback) { var http=GetXmlHttpObject() if (!http) { var errortext="Browser does not support HTTP Request"; @@ -109,17 +109,20 @@ function ajax_http(method,url,body,callback,errorcallback) { } http.onreadystatechange=statechange; http.open(method,url,true) + if (contenttype != null) { + http.setRequestHeader("Content-Type", contenttype) + } http.send(body) } return http } function ajax_http_get(url,callback,errorcallback) { - ajax_http("GET",url,null,callback,errorcallback) + ajax_http("GET",url,null,null,callback,errorcallback) } function ajax_http_post(url,formdata,callback,errorcallback) { - ajax_http("POST",url,formdata,callback,errorcallback) + ajax_http("POST",url,formdata,null,callback,errorcallback) // See https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest#Using_FormData_objects } @@ -132,6 +135,10 @@ function ajax_http_post_json(url,formdata,cont,errorcallback) { ajax_http_post(url, formdata, with_json(cont,errorcallback), errorcallback); } +function ajax_http_post_querystring_json(url,querystring,cont,errorcallback) { + ajax_http("POST",url,querystring,"application/x-www-form-urlencoded",with_json(cont,errorcallback),errorcallback); +} + function with_json(cont,errorcallback) { return function(txt){ if(txt) { |
