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.

Filter by
Sorted by
Tagged with
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 ...
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 ...
14
votes
2answers
735 views

How to update Shipping rates using Ajax when cart item is deleted on Checkout-Cart page?

My Shipping rates are calculated based on item present in cart and now on deletion of item on Checkout/Cart page, I need to update the Shipping rates. As of now, Remove Item on Checkout/Cart page ...
10
votes
5answers
17k 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 ...
10
votes
1answer
28k 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 (...
9
votes
3answers
16k 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.
9
votes
3answers
12k views

How to render HTML with AJAX in Magento 2

I try to find the best way to render HTML through AJAX in Magento 2. Way 1 : Using Controller without layout File Foo/Bar/Controller/Popin/Content.php <?php namespace Foo\Bar\Controller\...
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,...
9
votes
1answer
1k views

Magento 2 Error in browser console Expected to start loader but did not find one in the dom

I have developed site in Magento 2.2.0 and created custom product listing page. I have used add to cart functionality using ajax but in console giving error:- "VM1386:5 Expected to start loader ...
8
votes
1answer
7k views

Magento 2 : Show loader till all ajax call not completed

I want to show loader till page not loaded or all Ajax call not completed in frontend and backend both side. Is it possible in Magento 2.0.7 ?
8
votes
1answer
6k views

Magento 2: How shipping rest api function called On Checkout?

When u click on "Ship here" on Checkout Page it calls magento/rest/default/V1/carts/mine/estimate-shipping-methods-by-address-id Then it goes to below JS files magento\vendor\magento\module-...
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 ...
8
votes
0answers
2k views

Magento2 visual swatch won't change product image [closed]

Created a configurable product with 20 different colors in the configuration process. I added different images for each color variation but when switching from colors on the front-end the ajax script ...
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 () { ...
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()-&...
7
votes
2answers
5k views

How to load all child block in controller

I am using Ajax to add to cart, so need to update the cart side bar. I have try this code in controller to render the block. Mage::app()->getLayout()->getBlockSingleton('page/html')->...
7
votes
1answer
16k views

Magento + JQuery + Ajax - How do I reload just parts of my custom Module instead of the whole Block?

I was just recently given the task to create a simple Product configurator for our Magento Template in 5 days, where you can choose some attributes and it calculates the price for you, fades over a ...
6
votes
3answers
6k 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 ...
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 ...
6
votes
2answers
20k views

How to get custom module controller url

I have custom admin page edittab.phtml in that page I have ajax call function deleteOldLens(id) { var url = "<?php echo $this->getUrl('/customtabs/ajax/deletelens');?>"; new Ajax....
6
votes
2answers
6k views

Get all updated cart items data with options in AJAX response

My Cart is looking like this with popup window: I am updating multiple configurable items in cart with custom options at a time by AJAX Call. So i am using updateItemOptionsAction() function. But I ...
6
votes
2answers
873 views

Magento 2 duplicate PHPSESSID cookie when using session_start() in custom php script

I have custom php script that is called with ajax. It must be stand-alone script to save spent resources because it is called 1-3 times per each page load. Init Magento for each ajax call would cause ...
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'...
5
votes
1answer
3k views

Return bool gives error “Invalid return type” for Ajax Controller

I want to call this controller through Ajax and have it return true or false. the methods all work correctly, however I get the error Invalid return type C:\Sites\retracted\wwwroot\vendor\magento\...
5
votes
5answers
4k 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 = "...
5
votes
2answers
2k views

Add to cart Ajax response 302 in magento 2?

I am facing some problem regarding product add to cart. Whenever i am trying to add any configurable of simple product to my cart. It is not getting added to cart. Also When i checked in console, I ...
5
votes
2answers
786 views

Magento 2 : Product grid serializer issue

Inserted a product grid in my custom admin form using the below code: UPDATED view/adminhtml/layout/mymodule_form.xml <fieldset name="assign_products"> <argument name="data" xsi:type="...
5
votes
1answer
11k 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 ...
5
votes
3answers
3k views

Magento 2 : Add to compare and add to wishlist with ajax

How to do add to compare and add to wishlist functionality using ajax. I want to do ajax functionality for wishlist and compare in homepage hot seller block products and listing page products. ...
5
votes
0answers
1k views

How to add product to wishlist after login by guest customer?

Add to wishlist is being done in AJAX for online customers and the products are successfully added in wishlist. For offline/guests, if they click add to wishlist a pop-up is shown with link to login. ...
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.
4
votes
2answers
345 views

Magento 2 - Slick slider function not working

Slick slider function is not working after ajax response, This is the order of my code. Firstly I got a product collection response, Then I wrote a slick slider function. but slider function is not ...
4
votes
2answers
5k 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 ...
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.
4
votes
3answers
1k views

how to show products with category filter in header search

I am trying to display category based auto suggest results in header search, form.mini.phtml <form id="search_mini_form" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" ...
4
votes
4answers
6k views

Magento 1.9.3.3 - How do you return a JSON array from a controller to ajax

I have a ajax call to a controller (suburbSearchAction) which retrieves a list of suburbs based suburb text received from the user Ajax call inputSuburbData = jQuery(inputSuburb).val().trim(); ...
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
1answer
873 views

CE 1.9.1 - checkout in lightbox/popup

I know that this is a silly question, and ignores all UX practices, but I have a requirement to call the OneStepCheckout from LotusBreath into a lightbox or popup. Is this possible? Last resort ...
4
votes
1answer
1k views

For Ui Component admin form Field with ajax updating the select value

I have a select field in the UI component, on the changing the select field with ajax how to load the next select field.in the admin side?
4
votes
1answer
821 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 ...
4
votes
1answer
2k views

Controller to Ajax Estimate Shipping - Load Block and display phtml

I copied estimatePostAction and made estimateAjaxPostAction (overrided core - i did not hack the core). The controller action works as well (class Mage_Checkout_CartController). Now I want to get/...
4
votes
0answers
56 views

How to create a basic progress bar with ajax, when il click add to cart in Magento 2?

I try to make a basic progress bar with ajax , when I click button add to cart, but I don't know how catch the xhr on console,to put on alert() or prepend()function I follow a video example in ...
4
votes
1answer
3k views

How to get quote and update total through AJAX Magento 1.9

In cart page when postal code is entered and pressed get quote button then it submits one form and shows the rate of that postal code after that update button appears and clicking on that updates the ...
4
votes
2answers
2k views

Apply Magento Coupon in Ajax Without Redirecting to Cart Page

I have coupon code on sidebar on my product categories list, cart and checkout page. Whenever I'm trying to add coupon code while being on the product or category list page or checkout page, it is ...
4
votes
0answers
1k views

Magento controller custom action redirecting [closed]

I have a customer action on a customer controller I am creating. My controller extends Mage_Adminhtml_Controller_Action. Whenever I send a POST request to a customer controller action instead of ...
4
votes
1answer
1k views

Tracking Ajax Add to Cart Event

I have a problem I've been struggling for a couple of days and I would really like you to point me in the right direction. I am developing a module to track basic stuff like addToCart and ViewContent ...
3
votes
2answers
13k views

Magento custom add to cart doesnt update cart data until page refresh

I am creating a small ajax add to cart functionality which works but is proving to be relatively expensive from the performance side of things. I am hoping someone can provide a more efficient way to ...
3
votes
1answer
2k views

Magento 2 automatically appends form key at the end of my ajax call

I am trying to use jquery to perform ajax call to a magento rest api from a custom backend (admin) module. For some reason, every time I perform ajax call, the query parameter isAjax=true ...
3
votes
1answer
1k views

Add to cart issue - Magento 2.1

In Magento 2.1 When I enable Ajax on add to cart on Product detailed Page by "bindSubmit": true in add-to-cart.phtml <script type="text/x-magento-init"> { "#product_addtocart_form": ...
3
votes
2answers
5k views

AJAX Auto Update on One Step Checkout

What code that trigger the ajax auto reload on payment method and order review on one step checkout? is it on the /skin/frontend/base/default/js/checkout/opcheckout.js