{"id":9671,"date":"2022-03-27T13:23:08","date_gmt":"2022-03-27T11:23:08","guid":{"rendered":"https:\/\/geehootek.com\/how-to-avoid-admin-ajax-php-400-bad-request-error-when-trying-to-use-ajax-in-wordpress-plugin-zh-hans\/"},"modified":"2022-12-10T12:50:09","modified_gmt":"2022-12-10T11:50:09","slug":"how-to-avoid-admin-ajax-php-400-bad-request-error-when-trying-to-use-ajax-in-wordpress-plugin-zh-hans","status":"publish","type":"post","link":"https:\/\/geehootek.com\/zh-hans\/how-to-avoid-admin-ajax-php-400-bad-request-error-when-trying-to-use-ajax-in-wordpress-plugin-zh-hans\/","title":{"rendered":"\u5c1d\u8bd5\u5728 WordPress \u63d2\u4ef6\u4e2d\u4f7f\u7528 ajax \u65f6\u5982\u4f55\u907f\u514d admin-ajax.php 400 \u9519\u8bef\u8bf7\u6c42"},"content":{"rendered":"\n<p>\u5f53\u60a8\u5c1d\u8bd5\u5728 wordpress \u63d2\u4ef6\u5f00\u53d1\u4e2d\u4f7f\u7528 ajax \u6280\u672f\u65f6\uff0c\u4e0e\u6b63\u5e38\u65b9\u5f0f\u6709\u4e00\u4e9b\u4e0d\u540c\u3002 \u6211\u4e00\u76f4\u5728\u52aa\u529b\u548c\u641c\u7d22\u5b83\u5f88\u957f\u65f6\u95f4\uff0c\u5f88\u96be\u5f97\u5230\u4e00\u4e2a\u5e16\u5b50\u6765\u8bf4\u5f97\u5f88\u6e05\u695a\u3002 \u6240\u4ee5\u5728\u8fd9\u91cc\uff0c\u6211\u8bd5\u56fe\u5bf9\u5176\u4e2d\u7684\u6240\u6709\u5173\u952e\u70b9\u505a\u51fa\u66f4\u597d\u7684\u89e3\u91ca\u3002<\/p>\n\n<p>\u7531\u4e8e\u5728wordpress\u540e\u7aef\u4f7f\u7528ajax\u7684\u65b9\u5f0f\u4e0e\u524d\u7aef\u4e0d\u540c\uff0c\u800c\u5728\u540e\u7aef\uff0c\u5b83\u66f4\u5bb9\u6613\u3002 \u6211\u53ea\u4f1a\u505a\u4e00\u4e2a\u5173\u4e8e\u524d\u7aef\u7684\u8bdd\u9898\u3002<\/p>\n\n<p>\u5728\u60a8\u9605\u8bfb\u8fd9\u7bc7\u6587\u7ae0\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u60a8\u5177\u6709 WordPress \u63d2\u4ef6\u5f00\u53d1\u3001ajax\u3001php \u7b49\u65b9\u9762\u7684\u57fa\u7840\u77e5\u8bc6\uff0c\u8fd9\u6837\u60a8\u5c31\u4e0d\u4f1a\u6d6a\u8d39\u65f6\u95f4\u9605\u8bfb\u5b83\u800c\u5f97\u4e0d\u5230\u4efb\u4f55\u5e2e\u52a9\u3002<\/p>\n\n<p>\u592a\u597d\u4e86\uff0c\u8ba9\u6211\u4eec\u5f00\u59cb\u5427\u3002<\/p>\n\n<h2 class=\"wp-block-heading\">\u8981\u70b91<\/h2>\n\n<p>\u5982\u679c\u60a8\u6709\u4e00\u4e2a\u5355\u72ec\u7684 javaScript \u6587\u4ef6\uff0c\u5047\u8bbe\u8be5\u6587\u4ef6\u662f\u63d2\u4ef6\u6587\u4ef6\u5939\u4e0b\u7684 js\/your_ajax_script.js\uff0c\u90a3\u4e48\u60a8\u5fc5\u987b\u786e\u4fdd\u9996\u5148\u4f7f\u7528 wp_enqueue_script() \u5305\u542b\u6b64\u811a\u672c\u3002 \u7136\u540e\u4f7f\u7528 wp_localize_script() \u521b\u5efa\u4e00\u4e2a ajax_object \u4f9b\u60a8\u8fdb\u4e00\u6b65\u4f7f\u7528\u3002<\/p>\n\n<pre class=\"wp-block-code\"><code>add_action( 'wp_enqueue_scripts', array($this, 'enqueue_frontend_script') );\n\nfunction enqueue_frontend_script(){\n        wp_enqueue_script( 'ajax-script', <strong>PLUGIN_URL <\/strong>. 'js\/your-ajax-script.js', array('jquery') );\n        wp_localize_script( 'ajax-script', '<strong>your_ajax_object<\/strong>', array( 'ajax_url' =&gt; <strong>admin_url( 'admin-ajax.php' )<\/strong> ) );\n}<\/code><\/pre>\n\n<p>PLUGIN_URL \u662f\u5f15\u7528\u4f60\u7684\u63d2\u4ef6 url \u7684\u5e38\u91cf\uff0cyour_ajax_object \u662f ajax_object \u7684\u540d\u79f0\uff0c\u4f60\u53ef\u4ee5\u968f\u610f\u547d\u540d\u3002 array( &#8216;ajax_url&#8217; =&gt; admin_url( &#8216;admin-ajax.php&#8217; ) \u662f your_ajax_object \u7684\u5c5e\u6027 ajax_url \u7684\u5b9a\u4e49\u3002\u786e\u4fdd admin_url( &#8216;admin-ajax.php&#8217; ) \u6ca1\u6709\u62fc\u5199\u9519\u8bef<\/p>\n\n<h2 class=\"wp-block-heading\">\u8981\u70b92<\/h2>\n\n<p>\u6211\u4eec\u5148\u6765\u770b\u811a\u672c\u3002<\/p>\n\n<pre class=\"wp-block-code\"><code>jQuery(document).ready(function($){\n    $('.btn_del_row').click(function(){\n        var id = $(this).data('id');\n        var confirmalert = confirm(\"Are you sure ?\");\n        if (confirmalert == true) {\n            var <strong>data <\/strong>= {\n                'action': '<strong>your_ajax_action<\/strong>',\n                'id'    : id,\n            };\n            jQuery.post( <strong>your_ajax_object<\/strong>.<strong>ajax_url<\/strong>, <strong>data<\/strong>, function(response){\n                alert('Got this from the server: ' + response);\n            });\n        }\n    });\n});<\/code><\/pre>\n\n<p>\u5728\u6b64 javascript \u4e2d\uff0c\u786e\u4fdd\u4f7f\u7528\u60a8\u5b9a\u4e49\u7684 ajax_object \u53ca\u5176\u5c5e\u6027\uff0c\u5728\u6211\u4eec\u7684\u4f8b\u5b50\u4e2d\u662f your_ajax_object.ajax_url\u3002<\/p>\n\n<p>\u5728\u53d1\u9001\u7ed9\u52a8\u4f5c\u7684\u6570\u636e\u4e2d\uff0c\u4f60\u5fc5\u987b\u63d0\u5230\u52a8\u4f5c\u540d\u79f0\uff0c\u5728\u6211\u4eec\u7684\u4f8b\u5b50\u4e2d\u662f\u8fd9\u4e2a\u6c14\u5473&#8217;action&#8217;\uff1a&#8217;your_ajax_action&#8217;\uff0c\u4f60\u53ef\u4ee5\u968f\u610f\u547d\u540d\u8fd9\u4e2a\u52a8\u4f5c\u540d\u79f0\uff0c\u4f46\u8bf7\u8bb0\u4f4f\uff0c\u4f60\u5fc5\u987b\u4f7f\u7528 \u5728\u9700\u8981\u7684\u5730\u65b9\u4f7f\u7528\u5b8c\u5168\u76f8\u540c\u7684\u540d\u79f0\u3002 \u4f60\u4f1a\u770b\u89c1\u3002<\/p>\n\n<h2 class=\"wp-block-heading\">\u8981\u70b93<\/h2>\n\n<p>\u4e3a\u767b\u5f55\u548c\u767b\u5f55\u7528\u6237\u6302\u94a9\u60a8\u7684\u64cd\u4f5c\u529f\u80fd\u3002<\/p>\n\n<pre class=\"wp-block-code\"><code>add_action( 'wp_ajax_<strong>your_ajax_action<\/strong>', '<strong>your_ajax_action<\/strong>' );\nadd_action( 'wp_ajax_nopriv_<strong>your_ajax_action<\/strong>', '<strong>your_ajax_action<\/strong>' );\n\nfunction <strong>your_ajax_action<\/strong> (){\n    global $wpdb;\n    $id = $_POST&#091;'id'];\n    \/\/ do something you like ...\n    echo $result;\n    <strong>wp_die();<\/strong>\n}<\/code><\/pre>\n\n<p>\u770b\u770b\u4e0a\u9762\u7684\u4ee3\u7801\uff0c\u5e0c\u671b\u4f60\u6ce8\u610f\u5230\u6709 5 \u4e2a\u5730\u65b9\u4f7f\u7528\u4e86\u5728\u4f60\u7684 javascript \u4ee3\u7801\u4e2d\u5b9a\u4e49\u7684\u540c\u4e00\u4e2a\u8bcd\u201cyour_ajax_action\u201d\u3002 \u8fd9\u5fc5\u987b\u5b8c\u5168\u76f8\u540c\uff0c\u5426\u5219\u5c06\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\u3002<\/p>\n\n<p>\u5728 php \u51fd\u6570\u7684\u672b\u5c3e\uff0c\u4e0d\u8981\u5fd8\u8bb0\u4f7f\u7528 wp_die() \u5173\u95ed\u5b83\uff1b<\/p>\n\n<p>\u5728 wordpress \u63d2\u4ef6\u4e2d\u4f7f\u7528 ajax \u6709\u70b9\u70e6\u4eba\uff0c\u4f46\u5e0c\u671b\u60a8\u5728\u6309\u7167\u6211\u7684\u89e3\u91ca\u540e\u80fd\u591f\u6210\u529f\u5b8c\u6210\u3002<\/p>\n\t\t\t<link rel=\"stylesheet\" id=\"elementor-post-9527-css\" href=\"https:\/\/geehootek.com\/wp-content\/uploads\/elementor\/css\/post-9527.css?ver=1772509012\" type=\"text\/css\" media=\"all\">\n\t\t\t\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"9527\" class=\"elementor elementor-9527 elementor-1911\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-fa4a365 elementor-section-full_width elementor-section-content-middle elementor-section-height-default elementor-section-height-default wd-section-disabled\" data-id=\"fa4a365\" data-element_type=\"section\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-66 elementor-top-column elementor-element elementor-element-15d7811\" data-id=\"15d7811\" data-element_type=\"column\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-73bbe0e elementor-widget elementor-widget-wd_title\" data-id=\"73bbe0e\" data-element_type=\"widget\" data-widget_type=\"wd_title.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"title-wrapper set-mb-s reset-last-child wd-title-color-default wd-title-style-default wd-title-size-small text-left\">\n\n\t\t\t\n\t\t\t<div class=\"liner-continer\">\n\t\t\t\t<h4 class=\"woodmart-title-container title wd-fontsize-m\">\u53d1\u6d88\u606f\u7ed9\u6211\u4eec<\/h4> \n\t\t\t\t\t\t\t<\/div>\n\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-54f3057 elementor-widget elementor-widget-wd_contact_form_7\" data-id=\"54f3057\" data-element_type=\"widget\" data-widget_type=\"wd_contact_form_7.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\n<div class=\"wpcf7 no-js\" id=\"wpcf7-f1890-o1\" lang=\"en-US\" dir=\"ltr\" data-wpcf7-id=\"1890\">\n<div class=\"screen-reader-response\"><p role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"><\/p> <ul><\/ul><\/div>\n<form action=\"\/zh-hans\/wp-json\/wp\/v2\/posts\/9671#wpcf7-f1890-o1\" method=\"post\" class=\"wpcf7-form init wd-style-with-bg\" aria-label=\"Contact form\" novalidate=\"novalidate\" data-status=\"init\">\n<fieldset class=\"hidden-fields-container\"><input type=\"hidden\" name=\"_wpcf7\" value=\"1890\" \/><input type=\"hidden\" name=\"_wpcf7_version\" value=\"6.1.4\" \/><input type=\"hidden\" name=\"_wpcf7_locale\" value=\"en_US\" \/><input type=\"hidden\" name=\"_wpcf7_unit_tag\" value=\"wpcf7-f1890-o1\" \/><input type=\"hidden\" name=\"_wpcf7_container_post\" value=\"0\" \/><input type=\"hidden\" name=\"_wpcf7_posted_data_hash\" value=\"\" \/><input type=\"hidden\" name=\"_wpcf7_recaptcha_response\" value=\"\" \/>\n<\/fieldset>\n<div class=\"row wd-spacing-20\">\n\t<p class=\"col-lg-6\"><span class=\"wpcf7-form-control-wrap\" data-name=\"your-name\"><input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-text wpcf7-validates-as-required\" aria-required=\"true\" aria-invalid=\"false\" placeholder=\"\u60a8\u7684\u59d3\u540d\uff08\u53ef\u9009\uff09\" value=\"\" type=\"text\" name=\"your-name\" \/><\/span>\n\t<\/p>\n\t<p class=\"col-lg-6\"><span class=\"wpcf7-form-control-wrap\" data-name=\"your-email\"><input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-email wpcf7-validates-as-required wpcf7-text wpcf7-validates-as-email\" aria-required=\"true\" aria-invalid=\"false\" placeholder=\"\u90ae\u4ef6\u5730\u5740\uff08\u5fc5\u586b\uff09\" value=\"\" type=\"email\" name=\"your-email\" \/><\/span>\n\t<\/p>\n\t<p class=\"col-lg-12\"><span class=\"wpcf7-form-control-wrap\" data-name=\"your-sms\"><input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-tel wpcf7-text wpcf7-validates-as-tel\" aria-invalid=\"false\" placeholder=\"\u7535\u8bdd\u53f7\u7801\uff08\u53ef\u9009\uff09\" value=\"\" type=\"tel\" name=\"your-sms\" \/><\/span>\n\t<\/p>\n\t<p class=\"col-lg-12\" ><select class=\"form-control\" id=\"Select service\">\n <option>\u4f01\u4e1a\u6240\u6709\u8005<\/option>\n <option>\u4f01\u4e1a\u5e02\u573a\u8425\u9500\u4e13\u5458<\/option>\n <option>\u5e7f\u544a\u670d\u52a1\u63d0\u4f9b\u5546<\/option>\n <option>\u81ea\u7531\u804c\u4e1a<\/option>\n <option>\u6570\u5b57\u8425\u9500\u4ee3\u7406\u5546<\/option>\n <option>\u5176\u4ed6<\/option>\n <\/select>\n\t<\/p>\n\t<p class=\"col-lg-12\"><span class=\"wpcf7-form-control-wrap\" data-name=\"Subject\"><input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-text\" aria-invalid=\"false\" placeholder=\"\u6807\u9898\uff08\u53ef\u9009\uff09\" value=\"\" type=\"text\" name=\"Subject\" \/><\/span>\n\t<\/p>\n\t<p class=\"col-lg-12\"><span class=\"wpcf7-form-control-wrap\" data-name=\"your-message\"><textarea cols=\"40\" rows=\"10\" maxlength=\"2000\" class=\"wpcf7-form-control wpcf7-textarea\" aria-invalid=\"false\" placeholder=\"\u6d88\u606f\u5185\u5bb9\uff08\u53ef\u9009\uff09\" name=\"your-message\"><\/textarea><\/span>\n\t<\/p>\n\t<p class=\"col-lg-6\"><input class=\"wpcf7-form-control wpcf7-submit has-spinner btn btn-color-white btn-shape-semi-round\" type=\"submit\" value=\"\u53d1\u9001\u6d88\u606f\" \/>\n\t<\/p>\n<\/div><div class=\"wpcf7-response-output\" aria-hidden=\"true\"><\/div>\n<\/form>\n<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-33 elementor-top-column elementor-element elementor-element-9706f11\" data-id=\"9706f11\" data-element_type=\"column\" data-settings=\"{&quot;background_background&quot;:&quot;gradient&quot;}\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e92e01d elementor-widget elementor-widget-wd_title\" data-id=\"e92e01d\" data-element_type=\"widget\" data-widget_type=\"wd_title.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"title-wrapper set-mb-s reset-last-child wd-title-color-white wd-title-style-default wd-title-size-small text-left\">\n\n\t\t\t\t\t\t\t<div class=\"title-subtitle subtitle-color-white subtitle-style-default wd-fontsize-xs\">\n\t\t\t\t\t\u6781\u72d0\u8f6f\u4ef6\u53ca\u7f51\u7edc\u5de5\u4f5c\u5ba4\t\t\t\t<\/div>\n\t\t\t\n\t\t\t<div class=\"liner-continer\">\n\t\t\t\t<h4 class=\"woodmart-title-container title wd-fontsize-m\">\u8054\u7cfb\u65b9\u5f0f<\/h4> \n\t\t\t\t\t\t\t<\/div>\n\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-901043d elementor-widget elementor-widget-wd_infobox\" data-id=\"901043d\" data-element_type=\"widget\" data-widget_type=\"wd_infobox.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"info-box-wrapper\">\n\t\t\t<div class=\"wd-info-box text-left box-icon-align-left box-style-base color-scheme-\" >\n\t\t\t\t\t\t\t\t\t<div class=\"box-icon-wrapper  box-with-icon box-icon-simple\">\n\t\t\t\t\t\t<div class=\"info-box-icon\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"info-svg-wrapper info-icon\" style=\"width:30px; height:30px;\"><svg id=\"svg-1948\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" height=\"48px\" viewBox=\"0 0 24 24\" width=\"48px\" fill=\"#1796e5\"><path d=\"M0 0h24v24H0z\" fill=\"none\"><\/path><path d=\"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z\"><\/path><\/svg> <\/span>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t\n\t\t\t\t<div class=\"info-box-content\">\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t<div class=\"info-box-inner set-cont-mb-s reset-last-child\"\n\t\t\t\t\t\t data-elementor-setting-key=\"content\">\n\t\t\t\t\t\t<p><span class=\"elementor-icon-list-text\">Nagykov\u00e1csi, Beseny\u0151telek u. 2, 2094<\/span><\/p>\n\t\t\t\t\t<\/div>\n\t\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8ac747e elementor-widget elementor-widget-wd_infobox\" data-id=\"8ac747e\" data-element_type=\"widget\" data-widget_type=\"wd_infobox.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"info-box-wrapper\">\n\t\t\t<div class=\"wd-info-box text-left box-icon-align-left box-style-base color-scheme-\" >\n\t\t\t\t\t\t\t\t\t<div class=\"box-icon-wrapper  box-with-icon box-icon-simple\">\n\t\t\t\t\t\t<div class=\"info-box-icon\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"info-svg-wrapper info-icon\" style=\"width:30px; height:30px;\"><svg id=\"svg-8827\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" height=\"48px\" viewBox=\"0 0 24 24\" width=\"48px\" fill=\"#1796e5\"><path d=\"M0 0h24v24H0z\" fill=\"none\"><\/path><path d=\"M20.01 15.38c-1.23 0-2.42-.2-3.53-.56-.35-.12-.74-.03-1.01.24l-1.57 1.97c-2.83-1.35-5.48-3.9-6.89-6.83l1.95-1.66c.27-.28.35-.67.24-1.02-.37-1.11-.56-2.3-.56-3.53 0-.54-.45-.99-.99-.99H4.19C3.65 3 3 3.24 3 3.99 3 13.28 10.73 21 20.01 21c.71 0 .99-.63.99-1.18v-3.45c0-.54-.45-.99-.99-.99z\"><\/path><\/svg> <\/span>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t\n\t\t\t\t<div class=\"info-box-content\">\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t<div class=\"info-box-inner set-cont-mb-s reset-last-child\"\n\t\t\t\t\t\t data-elementor-setting-key=\"content\">\n\t\t\t\t\t\t<p>+36309964556<\/p>\n\t\t\t\t\t<\/div>\n\t\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3c64084 elementor-widget elementor-widget-wd_infobox\" data-id=\"3c64084\" data-element_type=\"widget\" data-widget_type=\"wd_infobox.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"info-box-wrapper\">\n\t\t\t<div class=\"wd-info-box text-left box-icon-align-left box-style-base color-scheme-\" >\n\t\t\t\t\t\t\t\t\t<div class=\"box-icon-wrapper  box-with-icon box-icon-simple\">\n\t\t\t\t\t\t<div class=\"info-box-icon\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"info-svg-wrapper info-icon\" style=\"width:30px; height:30px;\"><svg id=\"svg-5739\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" height=\"48px\" viewBox=\"0 0 24 24\" width=\"48px\" fill=\"#1796e5\"><path d=\"M0 0h24v24H0z\" fill=\"none\"><\/path><path d=\"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z\"><\/path><\/svg> <\/span>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t\n\t\t\t\t<div class=\"info-box-content\">\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t<div class=\"info-box-inner set-cont-mb-s reset-last-child\"\n\t\t\t\t\t\t data-elementor-setting-key=\"content\">\n\t\t\t\t\t\t<p>Official@geehootek.com<\/p>\n\t\t\t\t\t<\/div>\n\t\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4c4391a elementor-widget elementor-widget-wd_infobox\" data-id=\"4c4391a\" data-element_type=\"widget\" data-widget_type=\"wd_infobox.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"info-box-wrapper\">\n\t\t\t<div class=\"wd-info-box text-left box-icon-align-left box-style-base color-scheme-\" >\n\t\t\t\t\t\t\t\t\t<div class=\"box-icon-wrapper  box-with-icon box-icon-simple\">\n\t\t\t\t\t\t<div class=\"info-box-icon\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"info-svg-wrapper info-icon\" style=\"width:35px; height:35px;\"><svg id=\"svg-2007\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" height=\"300\" width=\"300\" viewBox=\"-51.45 -69.25 445.9 415.5\"><g fill=\"#1796e5\" fill-rule=\"evenodd\"><path d=\"M274 167c-7.778 0-14-6.222-14-14s6.222-14 14-14 14 6.222 14 14c0 7.389-6.222 14-14 14m-69 0c-7.778 0-14-6.222-14-14s6.222-14 14-14 14 6.222 14 14c0 7.389-6.222 14-14 14m102.39 78.581C329.216 229.871 343 206.5 343 180.827 343 133.316 297.052 95 240 95s-103 38.316-103 85.827c0 47.512 45.948 85.828 103 85.828 11.87 0 22.974-1.533 33.695-4.598.766-.383 1.915-.383 3.063-.383 1.915 0 3.83.766 5.361 1.532l22.591 13.028c.766.383 1.149.766 1.915.766a3.433 3.433 0 003.446-3.448c0-.767-.383-1.533-.383-2.683 0-.383-3.063-10.728-4.595-17.242-.383-.766-.383-1.532-.383-2.299-.383-2.682.766-4.597 2.68-5.747\"><\/path><path d=\"M164 86c-8.93 0-16-7.07-16-16s7.07-16 16-16 16 7.07 16 16c0 8.558-7.07 16-16 16m-82 0c-8.93 0-16-7.07-16-16s7.07-16 16-16 16 7.07 16 16c0 8.558-7.07 16-16 16m41.96-86C55.646 0 0 45.895 0 102.88c0 30.98 16.502 58.899 42.983 77.64 1.919 1.53 3.454 3.824 3.454 6.884 0 .764-.384 1.912-.384 2.677-1.919 7.649-5.373 20.27-5.757 20.652-.383 1.148-.767 1.913-.767 3.06 0 2.295 1.919 4.207 4.221 4.207.768 0 1.535-.382 2.303-.765l27.248-15.68c1.919-1.148 4.222-1.913 6.524-1.913 1.152 0 2.303 0 3.454.383 12.665 3.442 26.48 5.736 40.297 5.736h6.908c-2.687-8.031-4.222-16.445-4.222-25.242 0-51.631 50.658-93.701 112.83-93.701H246C237.173 37.48 185.747 0 123.96 0\"><\/path><\/g><\/svg> <\/span>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t\n\t\t\t\t<div class=\"info-box-content\">\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t<div class=\"info-box-inner set-cont-mb-s reset-last-child\"\n\t\t\t\t\t\t data-elementor-setting-key=\"content\">\n\t\t\t\t\t\t<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-medium wp-image-1683\" src=\"https:\/\/geehootek.com\/wp-content\/uploads\/2021\/10\/Geehootek-code-300x300.png\" alt=\"\" width=\"250\" height=\"250\" srcset=\"https:\/\/geehootek.com\/wp-content\/uploads\/2021\/10\/Geehootek-code-300x300.png 300w, https:\/\/geehootek.com\/wp-content\/uploads\/2021\/10\/Geehootek-code-150x150.png 150w, https:\/\/geehootek.com\/wp-content\/uploads\/2021\/10\/Geehootek-code.png 378w\" sizes=\"(max-width: 250px) 100vw, 250px\" \/><\/p>\n\t\t\t\t\t<\/div>\n\t\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1513ffc elementor-widget-divider--view-line elementor-widget elementor-widget-divider\" data-id=\"1513ffc\" data-element_type=\"widget\" data-widget_type=\"divider.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-divider\">\n\t\t\t<span class=\"elementor-divider-separator\">\n\t\t\t\t\t\t<\/span>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2b4617f color-scheme-light text-left elementor-widget elementor-widget-text-editor\" data-id=\"2b4617f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>\u5982\u679c\u60a8\u5c31\u6211\u4eec\u5982\u4f55\u53ef\u4ee5\u5e2e\u52a9\u60a8\u516c\u53f8\u7684\u4e1a\u52a1\u6709\u4efb\u4f55\u95ee\u9898\uff0c\u6b22\u8fce\u53d1\u9001\u6d88\u606f\u7ed9\u6211\u4eec\uff0c\u6211\u4eec\u5c06\u5c3d\u5feb\u7ed9\u60a8\u7b54\u590d\uff01<\/p>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-445368f elementor-widget elementor-widget-wd_social_buttons\" data-id=\"445368f\" data-element_type=\"widget\" data-widget_type=\"wd_social_buttons.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\n\t\t\t<div class=\"wd-social-icons icons-design-colored icons-size-small color-scheme-light social-share social-form-circle text-left\">\n\n\t\t\t\t\n\t\t\t\t\t\t\t\t\t<a rel=\"noopener noreferrer nofollow\" href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https:\/\/geehootek.com\/zh-hans\/how-to-avoid-admin-ajax-php-400-bad-request-error-when-trying-to-use-ajax-in-wordpress-plugin-zh-hans\/\" target=\"_blank\" class=\" wd-social-icon social-facebook\" aria-label=\"Facebook social link\">\n\t\t\t\t\t\t<span class=\"wd-icon\"><\/span>\n\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\n\t\t\t\t\t\t\t\t\t<a rel=\"noopener noreferrer nofollow\" href=\"https:\/\/twitter.com\/share?url=https:\/\/geehootek.com\/zh-hans\/how-to-avoid-admin-ajax-php-400-bad-request-error-when-trying-to-use-ajax-in-wordpress-plugin-zh-hans\/\" target=\"_blank\" class=\" wd-social-icon social-twitter\" aria-label=\"Twitter social link\">\n\t\t\t\t\t\t<span class=\"wd-icon\"><\/span>\n\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\n\t\t\t\t\t\t\t\t\t<a rel=\"noopener noreferrer nofollow\" href=\"mailto:?subject=Check%20this%20https:\/\/geehootek.com\/zh-hans\/how-to-avoid-admin-ajax-php-400-bad-request-error-when-trying-to-use-ajax-in-wordpress-plugin-zh-hans\/\" target=\"_blank\" class=\" wd-social-icon social-email\" aria-label=\"Email social link\">\n\t\t\t\t\t\t<span class=\"wd-icon\"><\/span>\n\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\t\t\t<a rel=\"noopener noreferrer nofollow\" href=\"https:\/\/pinterest.com\/pin\/create\/button\/?url=https:\/\/geehootek.com\/zh-hans\/how-to-avoid-admin-ajax-php-400-bad-request-error-when-trying-to-use-ajax-in-wordpress-plugin-zh-hans\/&media=https:\/\/geehootek.com\/wp-content\/uploads\/2022\/03\/wordpress-admin-ajax-cache.jpg&description=%E5%B0%9D%E8%AF%95%E5%9C%A8+WordPress+%E6%8F%92%E4%BB%B6%E4%B8%AD%E4%BD%BF%E7%94%A8+ajax+%E6%97%B6%E5%A6%82%E4%BD%95%E9%81%BF%E5%85%8D+admin-ajax.php+400+%E9%94%99%E8%AF%AF%E8%AF%B7%E6%B1%82\" target=\"_blank\" class=\" wd-social-icon social-pinterest\" aria-label=\"Pinterest social link\">\n\t\t\t\t\t\t<span class=\"wd-icon\"><\/span>\n\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\t\t\t<a rel=\"noopener noreferrer nofollow\" href=\"https:\/\/api.whatsapp.com\/send?text=https%3A%2F%2Fgeehootek.com%2Fzh-hans%2Fhow-to-avoid-admin-ajax-php-400-bad-request-error-when-trying-to-use-ajax-in-wordpress-plugin-zh-hans%2F\" target=\"_blank\" class=\"whatsapp-desktop  wd-social-icon social-whatsapp\" aria-label=\"WhatsApp social link\">\n\t\t\t\t\t\t<span class=\"wd-icon\"><\/span>\n\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t\n\t\t\t\t\t<a rel=\"noopener noreferrer nofollow\" href=\"whatsapp:\/\/send?text=https%3A%2F%2Fgeehootek.com%2Fzh-hans%2Fhow-to-avoid-admin-ajax-php-400-bad-request-error-when-trying-to-use-ajax-in-wordpress-plugin-zh-hans%2F\" target=\"_blank\" class=\"whatsapp-mobile  wd-social-icon social-whatsapp\" aria-label=\"WhatsApp social link\">\n\t\t\t\t\t\t<span class=\"wd-icon\"><\/span>\n\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\t\t\t<a rel=\"noopener noreferrer nofollow\" href=\"https:\/\/telegram.me\/share\/url?url=https:\/\/geehootek.com\/zh-hans\/how-to-avoid-admin-ajax-php-400-bad-request-error-when-trying-to-use-ajax-in-wordpress-plugin-zh-hans\/\" target=\"_blank\" class=\" wd-social-icon social-tg\" aria-label=\"Telegram social link\">\n\t\t\t\t\t\t<span class=\"wd-icon\"><\/span>\n\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<a rel=\"noopener noreferrer nofollow\" href=\"viber:\/\/forward?text=https:\/\/geehootek.com\/zh-hans\/how-to-avoid-admin-ajax-php-400-bad-request-error-when-trying-to-use-ajax-in-wordpress-plugin-zh-hans\/\" target=\"_blank\" class=\" wd-social-icon social-viber\" aria-label=\"Viber social link\">\n\t\t\t\t\t\t<span class=\"wd-icon\"><\/span>\n\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\n\t\t\t<\/div>\n\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u60a8\u5c1d\u8bd5\u5728 wordpress \u63d2\u4ef6\u5f00\u53d1\u4e2d\u4f7f\u7528 ajax \u6280\u672f\u65f6\uff0c\u4e0e\u6b63\u5e38\u65b9\u5f0f\u6709\u4e00\u4e9b\u4e0d\u540c\u3002 \u6211\u4e00\u76f4\u5728\u52aa\u529b\u5bfb\u627e<\/p>\n","protected":false},"author":1,"featured_media":2260,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[119],"tags":[],"class_list":["post-9671","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress-zh-hans"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/geehootek.com\/zh-hans\/wp-json\/wp\/v2\/posts\/9671","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geehootek.com\/zh-hans\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geehootek.com\/zh-hans\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geehootek.com\/zh-hans\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/geehootek.com\/zh-hans\/wp-json\/wp\/v2\/comments?post=9671"}],"version-history":[{"count":3,"href":"https:\/\/geehootek.com\/zh-hans\/wp-json\/wp\/v2\/posts\/9671\/revisions"}],"predecessor-version":[{"id":9753,"href":"https:\/\/geehootek.com\/zh-hans\/wp-json\/wp\/v2\/posts\/9671\/revisions\/9753"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geehootek.com\/zh-hans\/wp-json\/wp\/v2\/media\/2260"}],"wp:attachment":[{"href":"https:\/\/geehootek.com\/zh-hans\/wp-json\/wp\/v2\/media?parent=9671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geehootek.com\/zh-hans\/wp-json\/wp\/v2\/categories?post=9671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geehootek.com\/zh-hans\/wp-json\/wp\/v2\/tags?post=9671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}