2022 Developer Survey is open! Take survey.

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
0 votes
1 answer
15 views

Uncaught SyntaxError: Unexpected token < in JSON at position 0

Magento2 Error Uncaught SyntaxError: Unexpected token < in JSON at position 0 in the Ajax response $.get(url, function(data) { $('#load-more-loader').hide(); $('#load-more-product').show(); var ...
user avatar
  • 3,426
0 votes
0 answers
5 views

How to run a JS code as soon as a user logs in through checkout. Magento 1.9

Guys I need to run a code as soon as a user logs in through checkout. But I'm not getting it, precisely because it sends a request to "/customer/account/loginPost/" and the return is a ...
user avatar
  • 177
0 votes
0 answers
11 views

How to add add to cart with ajax to custom phtml

I have to add add to cart button on homepage. I have custom phtml in my own module. I would like this button to work with ajax. Could someone please suggest something?
user avatar
  • 27
0 votes
0 answers
8 views

AJAX request processing forgot password form

I built another form where a customer can reset via ajax their password. The action form contains the "customer/account/forgotpasswordpost/" while the js is built $.ajax({ url: ...
user avatar
0 votes
2 answers
33 views

Field number validation

I need to validate a field in a custom form. The field should be not required, and should validate if the content entered in it are numbers. I added the validation on the form which works. What does ...
user avatar
  • 27
0 votes
2 answers
15 views

Can't load any data in backend

I've a (random ?) <pre> added in the end of the default json rendering content in backend (for users, products...). I'm sure I didn't touch anything from this part of the website, any ideas ?
user avatar
0 votes
0 answers
19 views

AJAX increment decrement buttons in category page

I need to add +/- buttons for quantity on the category page using AJAX, which I only found for the cart page. Please help!
user avatar
0 votes
0 answers
9 views

How do I set Listing UI Components to be loaded before rendering - as with ->setIsAjax(false) for Grids?

In some situations it's helpful to have grids load with the initial content, rather than via AJAX. In M1 (or M2 with Grids) setIsAjax(false) can be used, what is the equivalent for a Listing UI ...
user avatar
  • 13
0 votes
0 answers
36 views

Change toolbar-amount items dynamically on load more magento 2.4.3.p1

Friends, I want to change the values of toolbar items on the click of the load more button and also click on pager so can anyone have an idea then please share with me. Thank you in advance. Please ...
user avatar
0 votes
1 answer
13 views

Load More Produtcs Ajax functionality in magento 2

I want to add Ajax functionality for Loading Products on catalog page. https://prnt.sc/TbgsghHe-gVz I have added the button on the first page . Can anybody help me with the script plz. I want to make ...
user avatar
0 votes
0 answers
68 views

Ajax Page Reload Not working

am trying to reload the page when on ajax success, but its not working below is my code. <?php /** * @var \Pramod\Custom\Block\System\Config\Exportproduct $block */ ?> <script> ...
user avatar
  • 1,664
0 votes
0 answers
13 views

Actions via Ajax on UI Component listing

I'm adding some custom data to products, namely fixed quantities. These are to appear on the product edit page under a Quantities "tab". I'm using UI Components not blocks. After a great ...
user avatar
0 votes
1 answer
22 views

Magento 2: Create Dynamic Category Dropdowns on Frontend

I, once again, have to ask for your help. I need to create a modal that let the customer select their car brand, model and year, and I need to populate the select options depending on the selections ...
user avatar
0 votes
0 answers
89 views

401 unauthorized on sign in after creating customer via REST API

I am having some issues with creating new customers using rest api in magento 2.4 First I sign in with admin and get the token to be used later. Than I register new account using ajax: type: "...
user avatar
  • 143
0 votes
0 answers
48 views

How can I pass custom form data and load result page using Ajax?

New to Magento. My goal with this is to have customer pick price range and sort order from a custom form I created, then when form is submitted have Ajax pass the form data AND load the new page with ...
user avatar
0 votes
1 answer
140 views

Emoji is saving as (???????) in the database Magento 2

I added the Emojo library including JS and CSS files. Then it starts to display on the frontend. When I send the Emoji character via ajax. I am getting Emoji in the param request so while saving the ...
user avatar
0 votes
1 answer
32 views

Add pagination in custom module by ajax call

I have developed Custom module in which data retrieving from db perfectly, but i want to show first ten data(10 rows) at first page and at second page display next ten data and so on by Ajax call.
user avatar
0 votes
1 answer
57 views

Adding Dynamic Ui Components on select value change

I have a modal where I put a select ui component. I want than when the value of that select is changed I send an Ajax request to one of my controllers search in database an get a json response wich ...
user avatar
  • 1
1 vote
2 answers
55 views

Ajax api call doesn't works using onclick returns error 400

So I'm trying to do an API call using Ajax on the Admin page, when I add this API call in onclick attribute, it doesn't work it returns error 400 Bad request, BUT when the API call isn't vinculated at ...
user avatar
0 votes
0 answers
38 views

Magento 2 - Submit form to current page

I'm trying to launch a form with an action pointing to the same page. The form can be found on the details page of the customer's order: www.mysite.com/sales/order/view/order_id/255/ This is my code ...
user avatar
  • 285
1 vote
1 answer
66 views

Ajax api call returning Bad Request decoding error

I'm trying to do an ajax API call on the admin page, but it returns a Decoding error: \nUnable to unserialize value. Error: Syntax error... $('#button').on('click', function(){ $.ajax({ ...
user avatar
1 vote
2 answers
127 views

Api call using ajax on admin page returns invalid form key

i'm trying to do an api call using ajax on admin page, but it keeps returning "Invalid form key" <script type="text/javascript"> require([ "jquery" ], function (...
user avatar
0 votes
0 answers
11 views

How do I add javascript code to handle callback events after submission of coupon register?

I am using Magento 2.3.5-p2 I am required to trigger a javascript code as below once a user has successfully registered their coupon dataLayer.push({ 'event': 'trackEvent', 'eventDetails.category': '...
user avatar
0 votes
1 answer
76 views

Magento 2 - Direct download external file

In Magento 2, I try to force download a pdf file from an external link (I don't have the source file). All I succeed is opening the file in the new browser tab but the direct download doesn't work. Do ...
user avatar
  • 95
0 votes
0 answers
12 views

Menu tree via JSON and AJAX

I want to populate TOP Menu later via AJAX Is there some code available that can get this done. Or a code that will generate the needed JSON and then we will take this JSON as a response and ...
user avatar
0 votes
0 answers
157 views

The requested URL was rejected while trying to save the address book using special characters

Steps to Reproduce: Go to the storefront Log in as a customer Go to My Account Now go to Address Book and click on add new address button Fill the address form ( add special characters in mandatory ...
user avatar
0 votes
1 answer
24 views

How to show a popup when the checkbox is ticked in Magento using ajax

Just needed to add a popup modal when the checkbox is ticked and post the values to the controller.
user avatar
0 votes
1 answer
27 views

Magento 2.4.3 - Reload totals cart after ajax change quantity - shipping costs error

I use this code to reload cart with ajax after quantity changing - $.ajax({ url: form.attr('action'), data: form.serialize(), showLoader: true, success: ...
user avatar
  • 187
0 votes
1 answer
198 views

How to set data into session with ajax magento 2

How to set data into the session with ajax Magento 2, I want to store price into the session with ajax for when the site is refreshed price gets from the session, not from the database.
user avatar
  • 31
0 votes
1 answer
55 views

How to add product price to session with AJAX Magento 2

How to add the product price to session with AJAX Magento 2. Please give me an example of the custom module of this solution.
user avatar
  • 31
0 votes
1 answer
12 views

Use AJAX and get the values of text from the Admin Panel

I want to get the values from store->configuration. And print that value in the PDP page using AJAX. The value should be refresh all the time using AJAX.
user avatar
0 votes
0 answers
188 views

The Content-Security-Policy directive 'frame-ancestors' does not support the source expression ''unsafe-inline''

i am using magento 2.4.x and i want to send data from ajax to controller but i cant do that , the compiler doesn't enter to the controller class , is this because i have this error on my console on ...
user avatar
  • 109
0 votes
1 answer
29 views

Magento 2 : What is Purpose of Custom Varnish Synthetic Rule For Customer Ajax Login?

I have a situation where customer ajax login is not working even though the customer submits valid credentials. Instead, the page reloads and the customer is not logged in. To clarify, it DOES work ...
user avatar
0 votes
2 answers
25 views

How to run ajax in certain time interval in Magento2

I have added ajax to show a text which is fetched from my scope config(The value is given in the store->configuration). In my controller I am getting the value using scope config and used echo in ...
user avatar
0 votes
2 answers
105 views

can't send data from ajax to controller

in my case I have a controller and an Ajax data sending, but when I check the code the AJAX doesn't send anything and Magento doesn't enter to my controller, is it a problem of routing or what, this ...
user avatar
  • 109
0 votes
0 answers
200 views

Download a csv file by js in magento 2

I would like to know how can I download a CSV file after clicking on the export button through ajax call. Here is my code: Controller Code public function execute() { try { $...
user avatar
  • 3,131
0 votes
0 answers
28 views

Jquery dlmenu with Ajax for multilevel click not working properly

I have a custom menu which has been created with dlmenu and ajax. For first level, it has been come the first level menu ul li through Ajax fine and after that, dlmenu is working fine and has been ...
user avatar
0 votes
1 answer
29 views

Change minisearch bar input width on hover

I am trying to change the search bar input width when it expands on hover. <div class="search-wrapper"> <div class="search-content block block-search" id="search-...
user avatar
0 votes
1 answer
23 views

How to force reviews to appear on page load? trigger processReviews

I'm trying to make customer reviews appear on the PDP page without clicking on the reviews button. On reviews tab click, ajax request is being sent to the server and I want to send this request on ...
user avatar
  • 11
0 votes
0 answers
74 views

How to load opions in admin panel select ui component by ajax?

I need to make form in admin panel with ui components. In this for I need to choose customer/customers in, so I chose formElement="select". I created ui xml file, options provider and js ...
user avatar
0 votes
1 answer
386 views

Remove loader from product view page

Magento 2 adding page loading in product view page like this below in body tag <body data-container="body" data-mage-init="{&quot;loaderAjax&quot;: {}, &quot;loader&...
user avatar
  • 828
1 vote
0 answers
104 views

Magento 2 POST Request Return 302 Redirect [closed]

I have Image Manager from Ves Base Widget, the issue is when the user tried to upload the image from his computer to the image manager, so that means the request called from Javascript and returned ...
user avatar
0 votes
0 answers
28 views

Customer Create using Ajax in magenot 2.4

I Want to create new customer using ajax in Magento 2.4. If Customer is register success show popup and show success message. Please help me. THANKS.
user avatar
  • 3,167
0 votes
1 answer
20 views

Make action available only for admin

I added a button to admin order view which sends request to an url of an action controller (using ajax), and now I need to somehow make it available only for admin. What is the best solution for this ...
user avatar
0 votes
1 answer
125 views

Login caching and sessions

So were using this third party catalog thing which I don't like much at all. I won't get into all the details of my disliking but for starters it runs in an iframe. Now if a customer is browsing ...
user avatar
0 votes
1 answer
279 views

Ajax is not working going to 404 in Magento 2.4.2 Admin

I am creating module for frontend and backend and want to run ajax with in the modules. My ajax is perfectly working on frontend but it doesn't work on admin side. My Ajax URL is http://127.0.0.1/mag/...
user avatar
  • 526
0 votes
1 answer
137 views

Magento 2 How to Render Child blocks in controller

I want to remove the 'Proceed to Checkout' button when the qty reaches a specified limit. For that I add a condition check in this page module-checkout\view\frontend\templates\onepage\link.phtml On ...
user avatar
0 votes
0 answers
64 views

My Account reorder link onclick Ajax call controller in magento 2.4

My Account reorder link onclick Ajax call controller in magento 2.3 app/code/Vendorname/Modulename/view/frontend/templates/order/history.phtml <?php if ($this->helper(\Magento\Sales\Helper\...
user avatar
0 votes
1 answer
29 views

Call to checkout URL redirecting to homepage

When adding a redirect to the checkout page in an Ajax done callback function, it seems to just go straight to the homepage instead: }).done(function (data) { if (data.error) { console.log(...
user avatar
  • 99
0 votes
1 answer
198 views

Magento2 Ajax change store currency and refresh total on Checkout page when change address

I want to change the current store currency by ajax and refresh the total when changing the address on the checkout page. I have successfully changed store currency by below code: $this->...
user avatar

1
2 3 4 5
16