Skip to main content

Timeline for How to send ADMIN AJAX request?

Current License: CC BY-SA 3.0

15 events
when toggle format what by license comment
S Jun 21, 2017 at 14:28 history suggested krle CC BY-SA 3.0
Add formating to javascript code
Jun 21, 2017 at 14:01 review Suggested edits
S Jun 21, 2017 at 14:28
Feb 8, 2017 at 9:42 comment added magento noob PostaPlus is your module handle. PostaPlus/HSCodes/index pass this to get $block->getUrl(). Like this $block->getUrl("PostaPlus/HSCodes/index");
Feb 8, 2017 at 9:18 comment added Roshan ruzaik I get this Url when I console log . But if i check this url in a new tab I get re directed to admin home page. localhost:8080/mg1/admin/PostaPlusShipping/HSCodes/index/key/… Appreciated very much your help. Really appreciated mate ;)
Feb 8, 2017 at 9:09 comment added magento noob var url =' <?php echo $block->getUrl("module_name/controller/action/")';?>' use this. Am on phone so can not format the answer properly
Feb 8, 2017 at 9:04 comment added Roshan ruzaik I think its not reaching my custom controller action. This phtml file is from MG core Shipment controller. And I'm trying to access my custom controller . I think ajax request is not reaching to my controller. How do I fix this? Basically I 'v rewrite core module controllers for my module
Feb 8, 2017 at 9:00 comment added magento noob Idk about chrome. Are you sure your ajax request is reaching your action ??? Use firebug then you may see the html response. It may be a 404 page as your url may be wrong. Try to check if you have correct url. Try to acess the url in new tab entering in address bar , see if you are getting the 404 page
Feb 8, 2017 at 8:55 comment added Roshan ruzaik I noticed that even if I dont give any URL like this url: "" I still get same page htmls.
Feb 8, 2017 at 8:54 comment added Roshan ruzaik No errors. I get output as entire current page as html codes. I check in Chrome developer tool only.
Feb 8, 2017 at 8:50 comment added magento noob Do you get any error ?? Try to use firebug in Firefox it will show you error
Feb 8, 2017 at 8:49 comment added Roshan ruzaik Tested as below but still same. changed in controller, public function execute() { //return $this->resultJsonFactory->create()->setData(['a' => 'b']); echo 'test string'; changed in JS, .success(function (data){ alert(data); console.log(data); }) But same results
Feb 8, 2017 at 8:40 comment added magento noob Try echoing the value in controller action and use .success() function instead of .done() in your ajax call
Feb 8, 2017 at 8:34 comment added Roshan ruzaik I did added like that and functions are working fine. Only AJAX return has the problem, <script> require([ "jquery", "jquery/ui" ], function($){ hscodes= { ............... ............... }); </script>
Feb 8, 2017 at 8:33 review First posts
Feb 8, 2017 at 8:37
Feb 8, 2017 at 8:30 history answered magento noob CC BY-SA 3.0