Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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
1
vote
0answers
405 views

Magento 2: How to place order using REST api url via ajax

I want to create a order in Magento 2 using REST api url i.e. http://localhost/taleb_check/rest/default/V1/carts/mine/payment-information. When we click place order button then this url get calls ...
1
vote
0answers
60 views

Magento 2 wrong session_id ajax

I have several mismatches with session_id in my production website : if I add a simple product to my cart with a freshly created customer, the session_id in the store switcher urls is not updated (...
0
votes
1answer
565 views

Load all gallery images in category on hover (Ajax)

I have a code to load all the gallery images of a product in category, it will work but the problem is that will load ALL gallery images for products in the category (list.phtml) so will increase ...
0
votes
1answer
587 views

How to get estimate shipping method in magento 2?

There are two problems mainly: my Ajax request not firing on change of postal code in cart. don't know why When I'm changing postal code on cart checkout page, Ajax request need to be fire on this ...
1
vote
0answers
209 views

Magento price slider not working

I have installed 4 price sliders from 3rd party extensions and in each one I am facing the same issue. The slider is not functioning the way I would like it. For example, we have products from $99 - $...
6
votes
2answers
991 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 ...
0
votes
1answer
88 views

Magento 2: Not receiving all post params in ajax call

I have an issue with an ajax call in magento 2. I am unable to receive the whole data from this ajax call in my Post params. As you can see in the images below These are the params sent over in ajax ...
1
vote
0answers
137 views

custom ajax call on billing address update magento 2

I am developing custom payment method, I need to call my js method renderer function when customer update billing address while checkout. I try to place this call in initialize but my method is not ...
3
votes
0answers
98 views

Initialise a Jquery Widget on Demand with Jquery

I have loaded my layered navigation over ajax to speed up my site load. The layered navigation also uses ajax and it's jQuery is normally initialised via RequireJS i believe with the below requireJS ...
0
votes
1answer
37 views

Set up Controller for AJAX

I am currently developing a new module for my company on Magento 2.1.8. The module requires the use of AJAX on the front end to send a receive data. This is what i currently have in one of my ...
0
votes
1answer
299 views

URL - Http Post Request with AJAX

I am developing a new module for my company in **Magento 2** and i require an AJAX Http post request, however I cannot find the correct URL. I have all of my controllers currently set up however, ...
1
vote
1answer
36 views

difficulties with displaying succes message after form is sent

I'm still learning the code languages that I used to create my form with. So I can't seem to figure out what seems to be the problem. Here's my code: HTML: <form action="mail.php" method="POST"&...
1
vote
1answer
422 views

Magento 2.2: How can I load the content of a table with Knockout JS when the page is rendered

I have created a custom page where customer accounts that belong to the same company are listed. The table content is based on an observable array so that it updates automatically when an account is ...
1
vote
1answer
480 views

403 on Onepage Checkout after custom ajax request

I've added a custom block to the payment step of the onepage checkout. I need to modify something in the cart without the onepage process being interrupted or anything refreshing/redirecting. I added ...
1
vote
3answers
2k views

Magento 2 - url.build does not work for admin url

I have tried url.build to build request url for ajax call in magento 2, it does not work ? JS File code: ( view/adminhtml/web/js/files.js) /*global window,requirejs*/ requirejs(['jquery', '...
0
votes
1answer
685 views

Magento 2 Passing php data to custom js component or file [duplicate]

I need to send ajax call on a button click in admin page. I want to send ajax url and record id from php to my js file in magento 2. How it can be done in standard way ? Thanks
0
votes
1answer
404 views

Ajax call failed to load content from Controller in Magento 2.1.4 Enterprise Edition

I am trying to do an auto search for my html form. I requesting to controller for data but it is saying: Failed to load http://127.0.0.1:8080/Project/abc/abc_foo/foocon/: No 'Access-Control-Allow-...
2
votes
2answers
3k views

Magento2 catch ajax complete, add to cart

I'm building an custom mini-cart. I want it to update itself when an article is added to the cart. I'm trying to do this by jQuery with catching the ajax complete, but can't get it to work. Can anyone ...
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?
0
votes
0answers
129 views

How to re-initialize requirejs after append HTML content into document? [duplicate]

I try to added HTML + RequireJS to DIV tag via ajax loading. With content contain tags like <script type="text/x-magento-init"> or data-mage-init attribute, It's easy to bind event using $('#...
1
vote
2answers
6k views

How to submit a form to controller using ajax with magento 2 validation

My form is like this <form data-mage-init='{"validation":{}}' id="donation-request-form" method="post" data-hasrequired="* Required Fields"> <div class="row"> <div class="...
1
vote
0answers
45 views

What is the best way to add a product to cart from phtml [duplicate]

I have created a new page in phtml in Magento 2 and have listed there some products and from there want to add a product to cart with php/ajax , and wan't to know which is the best way to do it. P.S. ...
1
vote
2answers
1k views

How to reset a form after form submission using ajax or how to empty the input fields in magento 2

How to reset a form after submission (which is submitted using ajax)?
1
vote
1answer
204 views

How to pass external script inside ajax response?

I am adding social share option on the page using Add This. I have added the code to my phtml file and added the js script in the head, which is working fine. Also, I have an option to filter data ...
1
vote
2answers
2k views

Calling loader show/hide function in magento 2 js template

I have been creating a custom component to load cart items in Magento 2 modal widget. I have to show a loader only in a custom div tag. Here is the code of my custom js component. define([ '...
1
vote
1answer
585 views

Product Review form in magento 2

I have modified product review form as popup modal, Now I have passed the form data through Ajax to my overrides controller, but it shows the below error. {"0":"Source class \"\XXX\YYY\Controller\...
0
votes
1answer
305 views

Review form in magento2.2

I have modified the review form as popup modal in my custom module. And now How to submit a Review form in ajax and need to pass the submitted values to controller, Please provide me a solution. My js ...
1
vote
0answers
47 views

How to save attachment in database using custom form in Magento 2?

I have created a custom form on the frontend, and want to save data in the database as well display in the admin. My Form: <form id="career-form" name="career-form" action="#" method="post"> ...
1
vote
0answers
33 views

Ajax Cart - Out of stock [closed]

I have ajax cart from porto theme. But when I am add more product than stock, the ajax cart crash (wheel is just rotating) and I got no message How to fix this issue?
1
vote
0answers
165 views

Magento 1.9 renderCategoriesMenuHtml very slow

I am trying to improve the store speed and I found that main Menu is very slow. I want to make magento do an ajax call for calling the menu, but I cannot understand how should work that. <?php $...
0
votes
1answer
92 views

Avoid caching image caching

is there a way to add versioning for the product image? I'm having trouble with image caching in the site, i can't control user browser for caching but maybe i can add a versioning for my images when ...
2
votes
1answer
348 views

Reload Customer Admin Tab Via Ajax

Within the customer area of admin I have created a wishlist manager where i can add products to a wishlist on behalf of a customer. This also has a grid showing the customers wishlist items however ...
1
vote
1answer
447 views

Order Id: Popup modal in magento 2

I have overrided the core(history.phtml corin module-sales) phtml file and created the custom link using popup modal to update the custom status as cancel initiated. And it works only for the last ...
0
votes
2answers
62 views

How to empty the form before loading in magento 2

I have created popup modal using ajax and it works successfully. But once the form submitted, it saves in DB. But if I click again to perform action, It simply shows prefilled message instead of new ...
0
votes
1answer
389 views

Force page rendering after new HTML is loaded by AJAX

I have a 3rd party extension for layered navigation in Magento 2.2.1. Products listing is repainted (using ajax) after customer changed the navigation filter (categories) There is some visual error ...
4
votes
0answers
180 views

Magento2 : How can use ajax in custom module html file

I have added a template file .html on checkout page in order summary below Totals, In this file I want to add ajax to call my custom module controller and load some content on page. How can I achieve ...
0
votes
1answer
235 views

Magento 2 load phtml file through Ajax in admin panel

I am trying to load phtml file though ajax in admin panel. Can one please suggest right way to approach that. $resultPage = $this->resultPageFactory->create(); $block = $resultPage->...
1
vote
0answers
1k views

Unable to call function in ajax success [closed]

$('.handleObject').on("change", function() { var id = $(this).val(); var cid = $('#cid').val(); $.ajax({ type: 'POST', url: '/example/shirt/listing', ...
1
vote
2answers
2k views

Magento 2 : Add to cart button change to go to cart after adding product

How to do the following - Clicking on "Add to Cart" button adds the product to cart then Button Changes to "Go to Cart" and clicking on that redirect to Shopping Cart Please help me in doing this ...
0
votes
0answers
835 views

Google Invisible reCaptcha : bad redirection with Ajax

I want to use Google Invisible reCaptcha with my Magento for the registration form. I download this extension : https://amasty.com/magento-google-invisible-captcha.html I configure in my BO and that ...
1
vote
0answers
336 views

Can't submit add-to-cart AJAX form because of duplicated form in mobile friendly product page

I'm working on a mobile design for a Megento product page, what I'm basically doing is duplicating the HTML for desktop and mobile display and showing/hiding the correct design according to the screen ...
2
votes
0answers
22 views

Advice on most performant approach to get variables once per session

I need to pass deviceType and userState(IL, IN, IA, KS, etc) variables to GTM for marketing purporses and wondering what’s the best way to do it. To calculate deviceType I will use mobiledetect php ...
1
vote
0answers
89 views

Prevent files from being uploaded after the UiComponent's ajax file upload

I'm currently implementing the UiComponent's Form Component, which has a section on using file uploads. You can define the file upload path and after selecting a file in your form, an AJAX call is ...
1
vote
1answer
238 views

Magento 2 “something went wrong” issue with request fields

We've had a recurring issue with Magento 2.2 where (for some reason I don't understand) the "Attention: Something went wrong." message appears on every page. We get the default message about a "...
0
votes
0answers
83 views

Ajax Update Product/OnePage Checkout Magento1

Since today i am experiencing a very strangle problem. Without changing anything, i can't update products (stuck on Please Wait...) and onepage checkout is stuck in step 2 (billing). Log files do not ...
5
votes
1answer
13k 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 ...
1
vote
0answers
33 views

Render Category View based on Products search

I'm trying to build a Live search. I have a Block Class that returns the necessary the products that i want to show. Now the Result page or the Category Page has a Controller that outputs the grid as ...
0
votes
1answer
783 views

Magento2, need help with ajax return data processing from controller which is string of html tags

considering below in controller: /** * * @return string */ public function execute() { $resultJson = $this->resultJsonFactory->create(); $layout = $...
0
votes
0answers
75 views

Magento 2 : How to improve ajax call?

I am making a ajax call in folowing way: require(['jquery'], function($){ $("#test1").change(function(){ var test1Value = document.getElementById("test1").value; var test1Label = $("#test1 ...
0
votes
1answer
655 views

Magento ajax Add to cart Not working

This is my Load more Script, first page Ajax Add to cart, working fine, but if I go to second page, ajax add to cart, is not working I checked the network tab for the add to cart ajax request, and ...