Advertisement
Guest User

Untitled

a guest
Mar 20th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. function changeChannel(channelID){
  2.  
  3. jQuery(document).ready(function($) {
  4. var data = {
  5. 'action': 'watchme_change_channel',
  6. 'whatever': channelID
  7. };
  8.  
  9. jQuery.post(ajaxurl, data, function(response) {
  10. alert(response);
  11. });
  12. });
  13.  
  14. add_action('wp_ajax_watchme_change_channel','watchme_change_channel_callback');
  15. add_action('wp_ajax_nopriv_watchme_change_channel','watchme_change_channel_callback');
  16.  
  17. function watchme_change_channel_callback() {
  18. global $wpdb; // this is how you get access to the database
  19. global $videos_meta;
  20. global $programming_meta;
  21. $whatever = $_POST['whatever'];
  22.  
  23. $echo_var[0]=get_user_meta($whatever, $videos_meta)[0];
  24. $echo_var[1]=get_user_meta($whatever, $programming_meta)[1];
  25. echo "life is not easy";
  26.  
  27. wp_die(); // this is required to terminate immediately and return a proper response
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement