Ajax in Wordpress plugin -



Ajax in Wordpress plugin -

i creating simple wordpress plugin , trying utilize ajax, 0 in ajax response.

<script type="text/javascript" > jquery(document).ready(function($) { var info = { action: 'my_action', whatever: '1234' }; jquery.post("http://localhost/taichi/wp-admin/admin-ajax.php", data, function(response) { alert(response); }); }); </script> <?php add_action('wp_ajax_my_action', 'my_action_callback'); add_action( 'wp_ajax_nopriv_my_action', 'my_action_callback' ); function my_action_callback() { echo "test"; die(); }

what doing wrong?

you have set add_action @ finish bottom of file or else won't find callback function

ajax wordpress plugins wordpress-plugin

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -