{"id":305,"date":"2014-11-05T13:30:19","date_gmt":"2014-11-05T17:30:19","guid":{"rendered":"http:\/\/www.joebillman.com\/blog\/?p=305"},"modified":"2014-11-05T13:30:19","modified_gmt":"2014-11-05T17:30:19","slug":"restful-calls-via-jquery","status":"publish","type":"post","link":"https:\/\/www.joebillman.com\/blog\/?p=305","title":{"rendered":"RESTful calls via JQuery"},"content":{"rendered":"<p>I created a post showing hoe to make RESTful calls with plain vanilla JavaScript and wanted to show how to do the same thing using JQuery. So here it is:<br \/>\n<\/p>\n<pre style=\"background-color:#e5e5e5;\">\nRESTService.prototype.doPost = function(url, data, successHandler, errorHandler)\n{\n    $.ajax(\n    {\n\tdata: JSON.stringify(data),\n\tdataType: 'json',\n\ttype: 'POST',\n\turl: url,\n\tbeforeSend: function(request)\n\t{\n\t    request.setRequestHeader('accept', 'application\/json');\n\t    request.setRequestHeader('content-type', 'application\/json;charset=UTF-8');\n\t},\n\tsuccess: function(response)\n\t{\n            successHandler(response);\n    \t},\n\terror: function(response)\n        {\n            errorHandler(response);\n\t}\n    });\n};\n<\/pre>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I created a post showing hoe to make RESTful calls with plain vanilla JavaScript and wanted to show how to do the same thing using JQuery. So here it is: RESTService.prototype.doPost = function(url, data, successHandler, errorHandler) { $.ajax( { data: JSON.stringify(data), dataType: &#8216;json&#8217;, type: &#8216;POST&#8217;, url: url, beforeSend: function(request) { request.setRequestHeader(&#8216;accept&#8217;, &#8216;application\/json&#8217;); request.setRequestHeader(&#8216;content-type&#8217;, &#8216;application\/json;charset=UTF-8&#8217;); }, &hellip; <a href=\"https:\/\/www.joebillman.com\/blog\/?p=305\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;RESTful calls via JQuery&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,21],"tags":[84],"class_list":["post-305","post","type-post","status-publish","format-standard","hentry","category-javascript","category-jquery","tag-jquery-2"],"_links":{"self":[{"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/305","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=305"}],"version-history":[{"count":0,"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/305\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}