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 siteTo 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:
– https://localhost/mywpsite/photocrati_ajax
– https://localhost/mywpsite/photocrati_ajax?action=get_gallery?id=1Both return the following error:
{“error”:”Not a valid AJAX action”}”
- The topic ‘AJAX Module Usage’ is closed to new replies.