{"id":215,"date":"2023-02-23T06:24:51","date_gmt":"2023-02-22T22:24:51","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=215"},"modified":"2023-04-30T15:27:05","modified_gmt":"2023-04-30T07:27:05","slug":"usage-of-contenttype-as-application-json-in-ajax","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/23\/usage-of-contenttype-as-application-json-in-ajax\/","title":{"rendered":"ajax\u4e2dcontentType\u4e3aapplication\/json\u7684\u7528\u6cd5"},"content":{"rendered":"<p>\u4e0d\u4f7f\u7528contentType: &quot;application\/json&quot;\uff0c\u5219data\u53ef\u4ee5\u662f\u5bf9\u8c61<\/p>\n<p><!-- more --><\/p>\n<pre><code class=\"language-javascript\">$.ajax({\n  url: url,\n  type: &quot;post&quot;,\n  datType: &quot;json&quot;,\n  data: { id: user_id },\n  async: false,\n  success: function () {}\n});<\/code><\/pre>\n<p>\u4f7f\u7528contentType: &quot;application\/json&quot;\uff0c\u5219data\u53ea\u80fd\u662fjson\u5b57\u7b26\u4e32<\/p>\n<pre><code class=\"language-javascript\">$.ajax({\n  url: url,\n  type: &quot;post&quot;,\n  datType: &quot;json&quot;,\n  contentType: &quot;application\/json&quot;\n  data: &quot;{&#039;id&#039;: &quot; + user_id +&quot;}&quot;,\n  async: false,\n  success: function () {}\n});<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0d\u4f7f\u7528contentType: &quot;application\/json&quot;\uff0c\u5219data\u53ef\u4ee5\u662f\u5bf9\u8c61 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[83],"class_list":["post-215","post","type-post","status-publish","format-standard","hentry","category-frontend-basic","tag-ajax"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/215","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=215"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/215\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=215"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}