ワードプレスでこれを行う適切な方法は、admin-ajax.php に直接投稿することです。その前に、スクリプトを登録し、jquery の例での「アクション」呼び出しで使用される関数を作成する必要があります。
jQuery.ajax ({
url: ajaxurl,
type: "POST",
data: {
postCommentNonce: postCommentNonce,
//this is your action function that wp will used for your call
action: "stg_AjaxRetRequestl",
//used to pass a var this can be anything
typekey: "cgetList",
});
これは、必要な残りのもののチュートリアルです。http://www.andrewmpeters.com/blog/how-to-make-jquery-ajax-json-requests-in-wordpress/ . ajaxurl とは何か疑問に思っている場合は、スクリプトを次のようにローカライズすることで取得できます。
wp_localize_script ("stgjsfiles", "stgjs", array ("ajaxurl" => admin_url ("admin-ajax.php"),
"postCommentNonce" => wp_create_nonce ("stg-post-nonce")));
グーグルで検索してください、たくさんの例があります