Page 1 of 1

CMS: Need help with AJAX call for plugin function

Posted: Thu Oct 20, 2016 3:57 am
by LavetaGulbransen
I'm writing a PHP plugin for CMS Made Simple and other CMS systems. I have to use the AJAX for a simple call to class of plugin functions.
I have to update the link-text information on clicking the link by getting the update text from the function output.

Right now, I am stuck with AJAX query. I have got a complex and non-systematic way to do (which is not normal while doing work with AJAX), but it is not working.
What is the 'right' or 'CMS Made Simple' way of including a call to function from AJAX program.

I does not get the output, when I click the link and it is working correctly on home page.

Here is the code:-

From main class I am calling:

From my main class here the PhP code:
if (class_exists(""splugin"")) {
$plugin = new SamplePlugin();
}

Actual code:
<?php
if (!function_exists('add_action')) {
require_once(""../../../wp-config.php"");
}
if (isset($plugin)) {
$plugin->doAjax();
} else {
echo ""Not done"";
}
?>

I am shifting my client from another CMS to 'CMS Made Simple'. And I am designing one plugin for the client. It is required that, when my client access internal pages of his website (like http://militarybases.co/directory/sierr ... erlong-ca/). He should get the following information on plugin page:-

Number of people visited the specific page during specific hours of the day?
Using a simple Machine Learning Algorithm, identify the potential client locations. It is achieved in Python(which is integrated with php).
At last, provide improvement updates in terms of optimization and performance.