Replies: 0
I’m developing a mobile app that I would like to make an AJAX call to WordPress to query a custom table in the database. I’m pretty sure I’m getting a cross domain origin problem, as even a simple function I have in a plugin is ignored.
// from the plugin
// In the Constructor for the class
add_action('wp_ajax_nopriv_weekly_push', array($this,'weekly_push'));
function weekly_push() { // just to return something in JSON
$content = array(
today => "not yesterday",
tomorrow => "not today",
yesterday =>"none of the above");
wp_send_json($content);
die();
// In the phone app
var notificationOpenedCallback = function(jsonData) {
alert("the callback is running");
var data = {
action : "weekly_push",
type: 'POST',
crossDomain:true ,
dataType : "json" };
jQuery.post("http://example.com/wp_admin/ajax.php", data, function(response) {
jQuery("#feedback").html(response);
});
alert(JSON.stringify(response));
};
The mobile app is recieving a push notification, but the data size limit is too small. How can I allow the mobile app (who doesn’t even have a domain of its own) access the function in order to aggregate the data needed?
Thanks in advance
Ed