View Single Post
Old 03-16-2017, 03:51 AM
ajeetsingh ajeetsingh is offline

Join Date: Dec 2016
Posts: 28

Default Issue in calling an ajax request in admin area.

Hello, I am X-Cart developer from Webkul Software Private Limited, UP, INDIA.
I have an issue in process of ajax calling in admin area on a page.
like: I had created a page with a button at admin area, I want to call a ajax request to click on that button. But when i click on that button to call a function which was already written in the same controller file but an error notice has occurs like below:
"The form could not be identified as a form generated by X-Cart. The reason may be that a substantial period of time has elapsed since you opened the page with this form or the page was opened in more than one browser tab. If you did not open the page with this form, you might be under a CSRF attack."
So can anyone Please help me.
My code are below:
1. In controller File the action is as below.
PHP Code:
* Export action
* @return void
protected function doActionSaveDemo(){
$tpId = \XLite\Core\Request::getInstance()->nIds;
'tpId : '.$tpId;

2. Ajax request is as below:
PHP Code:
function xyz(idss){
XMLHttpRequesttextStatusdatavalid) {
     if (
valid && data) {
console.log('Not valid');
nIdsidss }

Here number_demos is the controller which class is NumberDemos
Ajeet Singh
Sr.Software Developer
Webkul Software Pvt. Ltd.
Reply With Quote