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() 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() In my javascript file I have this piece to perform AJAX call: Code:
var str = "TEST STRING"; 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! |
Re: How to properly perform AJAX
Please check how \XLite\Controller\Customer\Rest and \XLite\Controller\Customer\Autocomplete controllers return JSON data.
I think this should help. |
Re: How to properly perform AJAX
Quote:
Thank you for your reply! I completely forgot about adding headers, but adding them did not solve my issue. I still kept receiving raw html of page on which my script was being executed. I solved this by using jQuery.ajax() post method instead and it worked just fine. But I still do not understand why I could not get core.post() to work. |
All times are GMT -8. The time now is 05:47 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.