CMS: Need help with AJAX call for plugin function

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Locked
LavetaGulbransen
New Member
New Member
Posts: 2
Joined: Wed Oct 19, 2016 11:06 am

CMS: Need help with AJAX call for plugin function

Post 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.
Locked

Return to “Developers Discussion”