{"id":10370,"date":"2011-08-18T08:00:00","date_gmt":"2011-08-18T08:00:00","guid":{"rendered":"https:\/\/www.weixiaoduo.com\/plugins\/2024\/02\/22\/ajax-extend\/"},"modified":"2011-08-20T16:20:00","modified_gmt":"2011-08-20T16:20:00","slug":"ajax-extend","status":"publish","type":"post","link":"https:\/\/www.weixiaoduo.com\/plugins\/ajax-extend\/","title":{"rendered":"ajax-extend"},"content":{"rendered":"<p>ajax-extend allows you call functions, a function in one plugin or a function you write or even a core wordpress function, via Ajax, in the easiest way.<\/p>\n<p>Example: The javascript code:<\/p>\n<pre>\n$j.ajax( {     url : home_url,     type : 'POST',     dataType : 'html',     data : {         'ajax_extend_mark' : 1, \/* this is indispensable if you want ajax-extend to call the function you need. *\/         'ajax_extend_action' : 'my_function', \/* the function name (a WP core function, or a function in one plugin. any functions loaded by wp()) *\/         'name' : 'sunjianle',     },     success : function(data, textStatus, errorThron) {         alert(data);     } }); <\/pre>\n<p>The background PHP code:<\/p>\n<pre>\nfunction my_function() {     $name = $_POST[\"name\"];     echo \"Hello, \" . $name;      global $wpdb;     $query_sql = \"select user_login                 from wp_users                 limit 0,10\";     $users = $wpdb->get_results($wpdb->prepare($query_sql));     foreach($users as $user){         echo $users->user_login;     } } <\/pre>\n","protected":false},"excerpt":{"rendered":"<p>'ajax-extend' allows you call functions, a function in one plugin or a function you write or even a core wordpress function, via Ajax, in th \u2026<\/p>\n","protected":false},"author":65,"featured_media":232323,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"ajax-extend - \u8587\u6653\u6735\u63d2\u4ef6\u76ee\u5f55","description":"'ajax-extend' allows you call functions, a function in one plugin or a function you write or even a core wordpress function, via Ajax, in th \u2026"},"footnotes":""},"categories":[1],"tags":[476,4100,584,826,4101,1630],"class_list":["post-10370","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-ajax","tag-core-functions","tag-functions","tag-javascript","tag-plugin-functions","tag-plugins"],"_links":{"self":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/10370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/comments?post=10370"}],"version-history":[{"count":0,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/10370\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media\/232323"}],"wp:attachment":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media?parent=10370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/categories?post=10370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/tags?post=10370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}