Title: AJAX Module Usage
Last modified: August 21, 2016

---

# AJAX Module Usage

 *  [eurotrashNM](https://wordpress.org/support/users/eurotrashnm/)
 * (@eurotrashnm)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/ajax-module-usage/)
 * Was looking at the source code for the nextgen and found the AJAX Module
 * I have few questions about how to use it. Ideally I would like to get a JSON 
   response of a complete gallery assuming that is even possible with this module…
 * The Read me states the following:
 * >  This module also adds some client-side variables to assist with executing 
   > your AJAX actions:
   >  => photocrati_ajax.url, the url used to post your AJAX 
   > requests to => photacrati_ajax.wp_site_url, the url of the WordPress site
   > To call an AJAX method using jQuery, you’d do the following:
   >     ```
   >     jQuery.post(photocrati_ajax.url, {action: "get_gallery", id: 1}, function(response){
   >     		if (typeof response != 'object) response = JSON.parse(response);
   >     	});
   >     ```
   > 
   > The above AJAX request will execute C_Ajax_Controller->get_gallery_action(),
   > which is
   >  expected to return valid JSON (even if there is an error)
 * My question is:
    1. What is the correct URL to use in the above code sample. 
   2. What is the correct format for passing the action and gallery ID parameters?
 * I have tried the following formats:
    – [http://localhost/mywpsite/photocrati_ajax](http://localhost/mywpsite/photocrati_ajax)–
   [http://localhost/mywpsite/photocrati_ajax?action=get_gallery?id=1](http://localhost/mywpsite/photocrati_ajax?action=get_gallery?id=1)
 * Both return the following error:
    {“error”:”Not a valid AJAX action”}”
 * [http://wordpress.org/plugins/nextgen-gallery/](http://wordpress.org/plugins/nextgen-gallery/)

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

 *  [Benjamin](https://wordpress.org/support/users/benjaminowens/)
 * (@benjaminowens)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/ajax-module-usage/#post-4511204)
 * Unfortunately ‘get_gallery’ is just an example and hasn’t been implemented.
 *  Thread Starter [eurotrashNM](https://wordpress.org/support/users/eurotrashnm/)
 * (@eurotrashnm)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/ajax-module-usage/#post-4511211)
 * Okay, thanks. Thought the module looked a little light in code.
 * Would be really sweet if was implemented as part of nextgen pro.
 *  [Saurabh Jain](https://wordpress.org/support/users/saurabhsjain91/)
 * (@saurabhsjain91)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/ajax-module-usage/#post-4511487)
 * Hi, try this
 * “YOUR_URL/index.php?callback=json&api_key=true&format=json&method=autocomplete&
   type=gallery”
 * It will give you the response of all the galleries you have created.
 * There is a file json.php which will show how to use that.

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

The topic ‘AJAX Module Usage’ is closed to new replies.

 * ![](https://ps.w.org/nextgen-gallery/assets/icon-256x256.png?rev=2083961)
 * [Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery](https://wordpress.org/plugins/nextgen-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nextgen-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nextgen-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/nextgen-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nextgen-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nextgen-gallery/reviews/)

## Tags

 * [ajax](https://wordpress.org/support/topic-tag/ajax/)
 * [json](https://wordpress.org/support/topic-tag/json/)
 * [nextgen](https://wordpress.org/support/topic-tag/nextgen/)

 * 3 replies
 * 3 participants
 * Last reply from: [Saurabh Jain](https://wordpress.org/support/users/saurabhsjain91/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/ajax-module-usage/#post-4511487)
 * Status: not a support question