How ever, here is the solution that i get how to use wp_ajax in wordpress.
Step 1.
You need to create callback function to handle ajax ( wp_ajax ) request.
function my_ajax_update(){ if (isset($_POST['c'])){ //you can do what ever here } }
Step 2.
create add_action using wp_ajax hook.
add_action("wp_ajax_your_action_name", "my_ajax_update");
your_action_name is action name that you'll submit using ajax post or get in Step 3.
Step 3.
on jQuery post..
url_action = \'' . get_bloginfo('wpurl') . '/wp-admin/admin-ajax.php\'; jQuery.post( url_action , { action:"your_action_name",c:"True" } ,function(data){ //your return result });
continue... next post I will show you the full plugin code.
0 comments:
Post a Comment