Title: Using AJAX in the admin
Last modified: August 18, 2016

---

# Using AJAX in the admin

 *  Resolved [chillpenguin](https://wordpress.org/support/users/chillpenguin/)
 * (@chillpenguin)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/using-ajax-in-the-admin/)
 * I’m writing a plugin that makes use of the AJAX. I thought it would be a good
   idea to go through the example here: [http://codex.wordpress.org/AJAX_in_Plugins](http://codex.wordpress.org/AJAX_in_Plugins)
 * Whenever I click on the button that looks up elevetion, Firebug reports that 
   myplugin_ajax_elevation is not defined. This tells me that
 * `add_action('admin_print_scripts', 'myplugin_js_admin_header' );`
 * does not work. Am I doing something wrong, or is there some other way to make
   this work?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [chillpenguin](https://wordpress.org/support/users/chillpenguin/)
 * (@chillpenguin)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/using-ajax-in-the-admin/#post-592409)
 * This may of some value to anyone who runs into the above problem: the example
   shown in the page I linked to only works with version 2.2.1 (and above, I assume).
   I was trying this on a 2.0.x WordPress blog.
 *  [LoganSix](https://wordpress.org/support/users/logansix/)
 * (@logansix)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/using-ajax-in-the-admin/#post-592676)
 * I think problem with is that the call to **myplugin_elev_lookup** should be to**
   myplugin_ajax_elev_lookup**. I am guessing that the function defined later `function
   myplugin_ajax_elev_lookup()` is what it is supposed to be looking for.
 * I haven’t gotten my own Admin AJAX to work either. It calls the JavaScript part
   fine, but then doesn’t call the php Function.
 *  [reckless](https://wordpress.org/support/users/reckless/)
 * (@reckless)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/using-ajax-in-the-admin/#post-592679)
 * Just started developing a plugin and this is where I’ve also got to! I’m using
   WordPress 2.5.
 * The Javascript call is made but when the wp_ajax call is forwarded the expression`
   if ( !isset($wp_filter[$tag]) )` is true (there was no onward filter in the list).
   It’s almost as if the action is no longer hooked which I suppose could be depending
   on how the session has been configured for the AJAX request. I’m an AJAX and 
   WordPress newbie so I could be wrong!
 * If anyone has any insight I’d really appreciate it! Thanks in advance!
 *  [reckless](https://wordpress.org/support/users/reckless/)
 * (@reckless)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/using-ajax-in-the-admin/#post-592680)
 * Found my issue. I was not loading my plugin objects if the invocation was not
   an Admin – using is_admin() – so I was partly on the track with the session configuration
   for the AJAX request. With an AJAX invocation the is_admin call returned false.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Using AJAX in the admin’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [reckless](https://wordpress.org/support/users/reckless/)
 * Last activity: [18 years, 1 month ago](https://wordpress.org/support/topic/using-ajax-in-the-admin/#post-592680)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
