87756

JQuery.Post() call to mvc controller from magento onepage checkout

Question:

Im doing a little messing around and on a learning curve with Magento, Jquery and programming and looking for some guidance with an issue Ive been stuck on.

I want to post some information to a controller of my custom module from one of the steps during onepage checkout.

The article at the following link has helped me understand how I could possibly achieve this and have followed that guide to the point that I am stuck at right now but my post call is posting back to my magento homepage as opposed to my specified controller action.

<a href="http://www.atwix.com/magento/ajax-requests-in-magento/" rel="nofollow">http://www.atwix.com/magento/ajax-requests-in-magento/</a>

I suspect I need to do this a little differently as I am trying to post back from onepage checkout. Can anyone point me in the right direction as to how I can make the jquery.post() call from onepage checkout to my magento controller action that is in my custom module ?

Answer1:

jQuery isn't installed by default in Magento. <a href="http://www.prototypejs.org/" rel="nofollow">Prototype</a> is. You want to do <a href="http://www.prototypejs.org/learn/introduction-to-ajax" rel="nofollow">this</a> in your Javascript:

new Ajax.Request('<?php echo $this->getUrl('module/controller/action'); ?>');

Where module is the name of your Module and so on.

Recommend

  • Adding custom anchor links and page links in WordPress menu clash
  • Traditional (standard) checkout (step by step page)
  • Why does checkout sometimes stage a file?
  • Disable add to cart redirection
  • c# web browser click on a button with a class name
  • SQL append distinct values from two columns and two tables
  • HALF_PTR Windows data type
  • Graceful pod termination
  • EntLib Way to Bind “Null” Value to Parameter
  • How do I import an existing Grails 3 (3.0.12) project in IntelliJ 15
  • iOS Cordova first plugin - plugin.xml to inject a feature
  • JQuery .html() remove line break on IE 8
  • Django model inheritance, filtering models
  • Sequential (transactional) API calls in angular 4 with state management
  • Access Android Market through SSH tunnel
  • Webgrid not refreshing after delete MVC
  • How do I exclude a dependency in provided scope when running in Maven test scope?
  • Is there a perl module to validate passwords stored in “{crypt}hashedpassword” “{ssha}hashedpassword
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • How to use remove-erase idiom for removing empty vectors in a vector?
  • Jquery UI tool tip close icon
  • Meteor helpers not available in Angular template
  • NHibernate Validation Localization with S#arp Architecture
  • Highlight one bar in a series in highcharts?
  • If I include Java 8 in my Android app does that affect which devices it will work on?
  • Android screen density dpi vs ppi
  • Bug in WPF DataGrid
  • Is possible to count alias result on mysql
  • How would I use PHP exceptions to define a redirect?
  • Finding past revisions of files in StarTeam w/ .NET SDK / C#
  • How to extract text from Word files using C#?
  • Redux, normalised entities and lodash merge
  • Confusion with PayPal's monthly billing cycle
  • Traverse Array and Display in markup
  • How to get icons for entities from eclipse?
  • Benchmarking RAM performance - UWP and C#
  • using HTMLImports.whenReady not working in chrome
  • how does django model after text[] in postgresql [duplicate]
  • need help with bizarre java.net.HttpURLConnection behavior
  • Qt: Run a script BEFORE make