Hi,
I have created one admin menu(Config) for configuration, class name is “myconfiguration”. How to include this class name & function name in my js file and print the post values in my particular function name.
I have implemented one button in my Config page whenever click the button after only i called the js file and print the post values in my php funtion.
This URL is correct or not “url: ‘oxajax.php?cl=myconfiguration&fnc=configuration’,”
Example: http://localhost/oxid/admin/oxajax.php?cl=myconfiguration&fnc=configuration ’;
Above url is correct or not.
jQuery.ajax({
url: ‘oxajax.php?cl=myconfiguration&fnc=configuration’,
type: ‘POST’,
dataType: ‘json’,
data: {
‘start’: jQuery(’#start_time ’).val(),
‘end’: jQuery(’#end_time ’).val(),
},
success: function(response) {
console.log(response);
},
error: function(response) {
console.log(response);
},
complete: function(response) {
}
It should be like this: SHOPURL/index.php?cl=myconfiguration
Hi rubbercut,
Thank you for your reply.
Your mentioned ulr is shop frontend, it’s working fine, but i need to use in admin side.
SHOPURL/admin/index.php?..
i think, you should simply use index.php instead of oxajax.php
Like VT has written, add “/admin” and you also can try it with relative paths. It’s not my way, but I would then add “/” in front to force loading the path.
Hi Vanilla_thunder,
Thank you for your reply.
I already try this but it will be redirected to admin login page.
for admin requests you need additional form data, like session id and token for authentication
Please give me an some example.
oxid shop is full of examples, its open soruce, simply look at any form in oxid admin
var SHOPURL=document.location.host;
$.ajax({
url: parent.location.protocol+"//"+SHOPURL+"/admin/index.php?cl=myconfiguration",
mohana
July 10, 2018, 10:35am
11
This solutions also redirected to shop admin login page.
Oh, it’s working in several modules
than maybe the folder /oxid/ is missing, Check it with console.log(SHOPURL);
mohana
July 11, 2018, 2:22pm
13
I send stoken value wrongly, so only i am getting redirect to admin login page. Now i send correct value it’s working fine.
Thank you very much.