javascript - Still failing to figure out what I'm doing wrong about making a PHP function handle an AJAX request in WordPress -


after literally hours of trying hook function handler ajax requests through wordpress's api, still coming short. i've gone basic trying basic test

<?php     add_action( 'wp_ajax_member_update', 'member_update' );      function member_update ( )     {         echo $_post['testvariable'];     } ?>  <script type="text/javascript">     jquery(document).ready(function($) {          var data = {             'action': 'member_update',             'testvariable': 1234         };          $.post(ajaxurl, data, function(response) {             alert('got server: ' + response); // expected: 1234         });     }); </script> 

and returning status code 200 , response 0. missing? i'm following the documentation far can tell.

if setting add_action code in page, action won't called since using ajaxurl , goes wp-load.php. should define action in theme's functions.php code , make available on site (as ajax requests).


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -