Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [ajax]

AJAX (Asynchronous JavaScript and XML) is a technique for creating seamless interactive websites via asynchronous data exchange between client and server. AJAX facilitates communication with the server or partial page updates without a traditional page refresh.

1
vote
3answers
157 views

Quote id is empty when inserting multiple records into cart in magento2

I am adding product to cart from ajax by passing product id Here is my controller code. use Magento\Framework\Controller\ResultFactory; use Magento\Framework\App\Action\Action; use Magento\...
10
votes
1answer
26k views

How to make a simple ajax call in Magento 2.1.0

I have added a simple button in one of my phtml file. <input type='button' name='emq_zip_btn' class='emq_zip_btn' value='Go'> I have added one custom js file ("emq.js") from a custom module (...
10
votes
4answers
15k views

How to enable AJAX for the the 'Add to Cart' button of product widgets in Magento 2?

In Magento 2 the normal Add to Cart button has a very nice AJAX-based logic to add products to the cart. However, when we use a Catalog Products List widget for example in CMS pages the button in this ...
9
votes
2answers
11k views

Magento2 - How to stop a product from getting added to cart programmatically?

What I want to do is if my custom attribute is set in quote then i do not want any product to be added in cart. My custom attribute is being set correctly. To stop product from getting added to cart,...
5
votes
1answer
10k views

Magento 2 - Send form data to Controller using AJAX and return Result to PHTML

I am working on a simple custom module, where user can input height and the weight/BMI will be shown as output on form submit. The page where user enters input is Calculation Page while output is ...
2
votes
1answer
2k views

Magento 2: How to refresh payment method on some condition

Like I have applied a checkbox on payment page for using it as credit score inspite of money. There is problem when my credit is 100 % used i.e. by using credit score grand total becomes 0. In that ...
9
votes
3answers
14k views

Magento 2: How to send data using Ajax form in custom form?

Can anyone explain me how I can create a simple form on Magento-2 page to send data using Ajax? I already have a form and controller action, that send data without using ajax.
4
votes
1answer
3k views

how to call controller using ajax in admin backend magento 2

I have to call the controller using Ajax in Admin backend of Magento 2. Can we directly call the controller or do we have to include any key values? Please help me.
1
vote
1answer
3k views

Magento 2: how to send ajax request in knockout js?

We have one button on checkout page to find address from our API. We want to send one ajax request to that API to get some data. How do we send ajax request from knockout js?
2
votes
1answer
4k views

jQuery ajax data to controller

I am trying to make my first ajax request in magento to controller file but can not get it working. My .js file is: jQuery.ajax({ type: 'post', url: 'vendor_module/index/...
0
votes
2answers
892 views

Ajax redirecting to system configuration page in admin custom module

Hello I have made a custom admin module, in which I am uploading image using using Ajax and for this I am using ajaxfileupload library. this is my edit.php file code which uses ajax code- <?php ...
1
vote
0answers
392 views

Show Discount Block in Cart Totals using Ajax [closed]

I am working on a custom module where I need to show my discount in cart totals. I am following Classyllama and Turnkey blog posts in order to achieve the same. I have come to a point where my custom ...
1
vote
3answers
3k views

How to update cart qty using ajax Magento 2

How to update cart qty using ajax magento 2 I want to change qty on cart page. I don't want to use the update button. It should be update automatically without reloading the page.
1
vote
2answers
3k views

Magento 2 : Update Cart summary html

When I use a bullet to increase qty then I use ajax to update cart. After call ajax how to update cart summary. I am stuck here please help me out from this. also, I used $("#cart-totals").trigger('...
4
votes
1answer
8k views

Magento 2 : How do I create my own action in controller to call url from Ajax in Magento 2.x

How Do I create my own Action in Controller to call url from Ajax in Magento 2.0. Like in Magento 1.9 we can create any Action an any Controller and call that from URL.
14
votes
3answers
11k views

Loading product view in category list with AJAX

Im trying to load the product view block in the category list page with AJAX using Ajaxify. Everything works fine the only issue being that the options box (childhtml "container1") is not loaded ...
2
votes
2answers
958 views

Timer countdown in product view page

I want to display timer countdown in product view page. how to achieve this ?
7
votes
1answer
5k views

Dynamic create block in magento 2 and send as ajax call response?

I want replacement of following in magento 2.x $block = $this->getLayout()->createBlock('customer/form_login')->setTemplate('persistent/customer/form/login.phtml'); $this->getResponse()-&...
5
votes
1answer
3k views

Magento2 <script type=“text/x-magento-init”> after ajax

Lets say I want to get ajax response containing everything that is inside #maincontent selector on catalog/product/view/id/1 page. The problem is that many JS (that works on product view page) doesn'...
1
vote
2answers
2k views

Ajax cart validation on change qty

I'm new to Ajax implementation and data-mage-init implementations in Magento 2. So what I'm trying to do : Situation now When you are in your cart -> URL/checkout/cart/ you need to press the update ...
8
votes
3answers
4k views

Mini-Cart displaying Parent Product Image instead of Product Image

I've got code that will display a product in the mini-cart using ajax, when a customer clicks on Add to Cart. The issue is that it is not displaying the child product image until I do a refresh of ...
7
votes
3answers
23k views

How do i call a controller function in ajax?

This is the content of my .../template/exportdb/attributes.phtml file: <span id = "attributes">Generate</span> <script type="text/javascript"> jQuery(function () { ...
6
votes
3answers
5k views

Magento 2 - Ajax is not calling Controller

I tried to make a simple ajax-call to my controller. Somehow I don't get a valid response. MyCompany/MyModule/Index/GetAjax.php namespace MyCompany\MyModule\Controller\Index; class GetAjax extends ...
4
votes
1answer
2k views

Magento 2 form ui component ajax fieldset

I see that in the latest versions of Magento 2, the add/edit form for categories, blocks and pages are generated via a ui component form xml. Here is the example for cms pages. I want to use that for ...
4
votes
2answers
4k views

Get current URL of page outisde AJAX request?

I'm loading parts of the page via AJAX whose content includes a customer login link: Mage::helper('customer')->getLoginUrl() Clicking the link gets the user to the login page and returns back to ...
2
votes
1answer
891 views

Magento2 - Ajax Add to Cart - Out of stock situation - Stop redirect and show message dynamically

I have implemented Ajax to my "Add to Cart" button so that customers can add products to their cart without reloading the page. Here is bare minimum of code which I used in order to achieve ...
2
votes
2answers
4k views

Update product sku with customs options skus on product pages and cart

How can I dynamically update the sku of a product on the product page when users select its custom options? Also, how could it then be passed into the cart page? Example: A product with sku XXX has ...
0
votes
2answers
3k views

How can i upload a file using prototype js ajax call

I have create a varien custom form and want to submit the form using prototype ajax.This form contain four fields two text field and two file field. But when i submit the data using ajax of ...
0
votes
1answer
1k views

Magento can't pass the Billing step in the checkout page

I have Magento 1.9.2.3 installed and I can't checkout, after complete all fields in the Billing Information section and press Continue, I have this error like in the attached image and when I check ...
15
votes
3answers
2k views

magento 2 remove mini cart item page reload?

How can I reload the page when I remove mini cart item ? I know it's Magento 2 bug. On the checkout cart page there are many products In mini cart as well as In checkout cart page when I remove In ...
4
votes
1answer
806 views

magento 2 Add to cart popup is not working after load the product using infinite ajax scroll [closed]

I have used infinite ajax scrolling on product listing page.Its working but there are one issue. Add to cart popup is not working after load product using infinite ajax scrolling. Please check ...
3
votes
3answers
4k views

Use secure urls on front end breaks ajax loading into cart [closed]

I want the site to only have ssl in the account and checkout pages. It seems that if in the admin I select "Use Secure URLs in Frontend" I get that. The issue is that while product pages, and links ...
2
votes
2answers
12k views

Retreive and return response from controller in magento2

I have a problem in which I'm making an AJAX call to a controller. But, I am not able to check whether it is working or not. I also want to return data in response. But, it keeps throwing some errors. ...
2
votes
2answers
1k views

Magento 2 admin - can no longer save configurable products after upgrade to 2.1

After upgrading from 2.0.7 to 2.1, none of my configurable products will save on edit. In the browser console I can see there is an ajax call to the Product/Validate controller that returns a 404 ...
1
vote
1answer
3k views

Magento 2 Ajax request fails

I made an ajax request (in the admin html) and got the following response: "{"error":true,"message":"You entered an invalid Secret Key. Please refresh the page."}" new Ajax.Request('...
1
vote
2answers
7k views

Success / Error message on ajax request

Currently, I am using ajax to add an coupon to the cart. This requires a success/error message to display to the user. However, it seems that i'm unable to retrieve this error/success message ...
1
vote
1answer
1k views

How to structure Ajax module/widget

I'm fairly new to Magento and have never attempted anything like this before, I'm still getting used to how Magento does things. I'm trying to create a widget which will add a 'Spraydeck finder' to ...
0
votes
4answers
10k views

Onepage Checkout registration redirects to cart; checkout/onepage/saveMethod returns 404

When a user proceeds to the checkout page and is not logged-in, it is presented with the form to login or create an account. "Allow guest checkout" is set to no. At this point, the user can log in ...
0
votes
1answer
1k views

Dispatch magento event with ajax

I have a magento event 'payment_method_is_active' and I want to call event with ajax.How can I do? UPDATE: I have an Observer : <frontend> <events> <...
0
votes
1answer
2k views

Magento 2 : How to Add Google Analytics when Item Added to Minicart

I want to track google analytics when user add item to minicart. I noticed that it make an ajax call to customer/section/load. So I want to add my google analytics code when these ajax success. ...
0
votes
2answers
7k views

No 'Access-Control-Allow-Origin' header in jquery ajax in magento site

I had used jquery ajax in my magento website.it is working fine on the localhost but on live i am getting error as follows. XMLHttpRequest cannot load https://www.abc.com/customer/ajax/...
6
votes
2answers
7k views

Setting AJAX URL for custom module

I have a JavaScript file in /js/mds/mds_collivery.js. In it I have an AJAX call that should go to magento_install_url/collivery/ajax/cptypes. It will only be used in /checkout/onepage/. However, if I ...
5
votes
5answers
3k views

Magento 2 Load More Product Script

I am using this script for Load More in Magento 2 But it's not working <script src ="https://infiniteajaxscroll.com/vendor/jquery-ias/dist/jquery-ias.min.js"></script> <link src = "...
3
votes
1answer
2k views

pass data from phtml file to controller

I want to pass data from my 'phtml' template file to controller file please help me to do this. this is my code for text box in phtml file <input type="text" class="input-text watch-keyup" id="...
2
votes
1answer
206 views

Generation does not exist

I have this code for a AJAX call: Controller/Data/Get.php <?php namespace Vendor\Module\Controller\Data; class Get extends \Magento\Framework\App\Action\Action { protected $...
2
votes
2answers
494 views

Magento Custom Grid Redirect Error (On Join Attributes ONLY)

To clarify, this is ONLY on join attributes My layout handles are correctly setup, I can filter the inherited columns correctly. $collection->getSelect()->join( array('...
2
votes
2answers
3k views

Magento2: Update minicart view using ajax

Is there any way to update the minicart view? Now I'm using require([ 'Magento_Customer/js/customer-data' ], function (customerData) { alert("hola"); ...
2
votes
3answers
489 views

code working in one phtml file not working in another

As this is marketplace multi vendor site, we are displaying vendor product information in frontend. List of products informations are displaying as in image : If we want to edit any information like ...
2
votes
3answers
3k views

How to remove html head body tags in layout magento 2

Controller <?php namespace Test\QuickView\Controller\Catalog\Product; class View extends \Magento\Catalog\Controller\Product\View { } Layout quickview_catalog_product_view.xml <?xml ...
1
vote
1answer
120 views

How to re init ajax add to cart inside the response in magento2

I have installed third-party module Infinite scroll for the lazy load(Lof_Ajaxscroll). The problem I am facing is Once the page loads new HTML content is generated from ajax. So add to cart is not ...