I
really need some help here.
This is a Bludit specific issue and I really can't see a way forward.
assumptions:
1 - I want to get data added to the admin side of a plugin page. I am presuming to use ajax. Yes?
2 - There are security checks to be passed - in that I am not allowed to just make the ajax call and have the results appear (console, alert, add to #div).
2. seems to be the sticking point.
Scenario - jQuery notes the click and opens a hidden div - AND adds the ajax data to that div.
I tried so many path variations and a few of those give the console: "Not allowed to load local resource:"
Which has me thinking I need to set up something in plugin.php to placate admin.?
in adminView()?
if (isset($_GET['akAjax'])) { } // or some such????
It would be great to have some feedback here - even just to confirm or adjust my assumptions.
Feel free to treat me as a newbie and spell out the seriously obvious.
This reminds me of my earlier post trying to upload my first plugin on gitHub... the missing key? just add '/' after the 'new file' to create is a folder. Easy when you know that
I will add a few of my avenues of enquiry below. Perhaps not relevant/useful but I have been burnt on stackOverflow for not showing attempted approaches.
_________________
various paths with the token added
in: bl-kernel there is a folder 'ajax' - it seems to relate to...
bl-kernel/js/bludit-ajax.php
the first call there has: let url = HTML_PATH_ADMIN_ROOT+"ajax/save-as-draft"
this runs ajax/save-as-draft.php
Do I need to set something up for my ajax? I suspect not.
from a general online AI search I found:
url: "/bludit/admin/ajax/logo-upload", // Replace with the actual Bludit endpoint
I tried various path permutations
similarly from:
https://git.leinelab.org/r31k/bludit/sr ... t-ajax.php
7 years ago..!
url: "<?php echo HTML_PATH_ADMIN_ROOT ?>ajax/save-as-draft"
I put a copy of my .php in the ajax folder and tried this. Nope.
I tried: bludit/admin/ajax/mySimpleTest.php and various other path alternatives
Nope.
searching the forum:
viewtopic.php?p=12050&hilit=ajax#p12050 - unresolved
I downloaded the Snicker plugin and tried to analyse the ajax calls - it is there but I couldn't tease out a simple line of action; my code knowledge limitations.
In docs.bludit.com I read through the API information and got:
fetch("
https://www.example.com/api/pages/my-do ... 6f3eccc826"
the path???
Trying so many path variations...
quite a few of those give the console: "Not allowed to load local resource:"
Which has me thinking I need to set up something in plugin.php to placate admin.?