View Single Post
  #1  
Old 11-29-2017, 10:29 PM
 
Alex L Alex L is offline
 

Newbie
  
Join Date: Nov 2017
Posts: 3
 

Default How to properly perform AJAX

I am having trouble with using AJAX. I have controller class derived from AAdmin with following action:

Code:
protected function doActionMyAction() { $list = \XLite\Core\Request::getInstance()->idlist; echo $list; }

I also have this piece so that I do not get forbidden thrown at me when I attempt to call that action:

Code:
public static function defineFreeFormIdActions() { return array_merge( parent::defineFreeFormIdActions(), array('myaction') ); }

In my javascript file I have this piece to perform AJAX call:

Code:
var str = "TEST STRING"; core.post( URLHandler.buildURL({ target: "crosscheck_order", action: "myaction" }), function (XMLHttpRequest, textStatus, data, valid) { console.log(data); }, { idlist: str} );

Instead of getting value of "str" in my console, I instead get raw html of the entire default template for this controller. Any tips on what I am doing wrong are very appreciated!
__________________
X-Cart Ultimate 5.2.14
Reply With Quote