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
2answers
67 views

Calling M2 REST API from browser for anonymous users

I'm trying to call REST endpoints from the browser. Initially, I'd like to be able to fetch product information. It looks like session-based authorization is what I'm after. I started by grabbing a ...
0
votes
0answers
43 views

Magento Amasty FPC and Dynamic Content

We have Amasty FPC and want to use their hole punch method for Dynamic Content but I’m a little confused on the XML configuration file. Their is two methods which have the block exclusions - one is ...
0
votes
3answers
495 views

How to create AJAX action for POST requests in Magento 2.3?

How to create a controller action that can be requested by POST properly in own custom payment module in Magento 2.3? How to create a parent class that will be extended by classes corresponding to ...
0
votes
0answers
316 views

Category page custom category filter magento2

I have loaded custom template before the product list in category list page. this is my block file Vendor/Module/Block/Category.php <?php namespace Vendor\Module\Block; class Category extends \...
1
vote
2answers
409 views

Populate sub category drop down based on category selected magento2

I have used below code to populate sub categories in other dropdown once the parent category is selected. Used this code in my template file. app/code/Vendor/Module/view/frontend/template/category....
0
votes
0answers
26 views

magento 2 getting product grid on passing category id in frontend

Is there a way i can get ajax response of product grid on passing category id. On a custom page i want to pass category id as ajax so that it can return product collection with image,title etc how it ...
2
votes
1answer
325 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 $...
1
vote
0answers
31 views

Forms not working with array fields

Don't know something has gone wrong. Suddenly on my magento (1.9) site forms which have array fields are not working. for example :- <input type="text" name="inputfield['first']" id="...
0
votes
2answers
243 views

Invalid Return Type in Ajax Call

I made an ajax script to (at the moment) simply return some HTML to a select. My function looks like this: $.ajax({ showLoader: true, data: {val: inputVal}, /*dataType: 'json', (un)...
1
vote
1answer
65 views

Get breadcrumb in Controller Action

I need to get the breadcrumb in the controller action because I am using the cache modules(FPC and another system externally). It cached the breadcrumb in the frontend page. With that, I would use ...
0
votes
1answer
23 views

I wish to add custom section in product detail page in magento 2

How to add custom button in product page,while clicking that button it needs to show custom form in a popup ?
0
votes
0answers
50 views

I want to update qty on checkout page using ajax without page load in magento1

When I update my qty page reload I am using this code qty update but when I refresh page /* here is mu code */ jQuery(document).ready(function(){ jQuery('.btn-update').on('click', ...
0
votes
2answers
193 views

Unable to call function in ajax success in magento2

I have found below error: > Uncaught TypeError: Cannot read property 'set' of undefined. Code: <script> require(['jquery','Magento_Customer/js/customer-data','domReady!'], function ($, ...
0
votes
1answer
302 views

Magento 2 Update cart automatically on carty quantity update gives error “Mismatched anonymous define() module”

I have done everything mentioned in this post, however, it gives me an error in console: require.js:166 Uncaught Error: Mismatched anonymous define() module: function ($, getTotalsAction, ...
1
vote
0answers
303 views

How to set success and error message when custompage ajaxcall in magento2?

I want to display success message when my custom form submitted . I am doing ajaxcall here. How to achieve this? I want default page.messages not custom message div.
0
votes
0answers
56 views

Return as json instead of Html from controller renderlayout

How my code look like. In frontend layout xml file my Handle is like. <wordpress_ajax_post> <block type="wordpress/homepage" name="root" output="toHtml" template="wordpress/homepage....
3
votes
1answer
1k views

Add product to wishlist using Ajax - get response message

I'm trying to implement adding product to wishlist using ajax. I have managed to do this but I can't get the success message from response ("You have added X product to wishlist"). require([ 'jquery'...
1
vote
1answer
211 views

Ajax call issue in magento 2.2.6

My ajax call not working . It returns "A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later." my ajax call code ...
1
vote
2answers
911 views

Unable to add success message in magento2?

Unable to add success message through ajax success function using messageManager in magento2. How to display default message of magento2 using ajax functionality? JS code $('#...
1
vote
1answer
467 views

Magento 2.3 admin custom form ajax not working

Custom form ajax submit data not working in magento 2.3 its working with magento 2.1 and 2.2.x versions. Error 401 (Unauthorized) Failed to load resource: the server responded with a status of ...
0
votes
1answer
283 views

Magento 2 ajax is not working

I am trying to save form details using AJAX. Below is my Code. etc/adminhtml/routes.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:...
0
votes
1answer
136 views

Change sorter in category select box to <ul> <li>

I want to change sort by select box into <ul> <li> type by using javascript so I can change style css for it. How can i do this?
1
vote
1answer
380 views

Magento 2: AJAX POST to AdminHTML

I have an AJAX POST setup within my template file currently that has 3 values, which I want to POST to my Index.php within my Block. However, my module is an AdminHTML module and this cannot be ...
1
vote
0answers
89 views

Update programmatically config content text/x-magento-init script inside of phtml template

For a requirement I had to override the config of the configurable.js script that is initialised inside configurable.phtml, this one specifically: <script type="text/x-magento-init"> { ...
2
votes
0answers
117 views

Mini Cart Update issue

I am facing mini cart update issue - to replicate the issue you need to browse the site and add a product to the cart - then continue shopping. If you press checkout (instead of continue shopping) the ...
0
votes
1answer
46 views

Get method in magento2

Why the get method ajax call content like.. /customer/section/load/?sections=messages&update_section_id=true&_=1540902816229 Thank You.
1
vote
0answers
209 views

Magento 2 Ajax add to cart related products

So I've found the location to turn on ajax add to cart in the product page. I've also found where the; $showCart: true Lives to enable the related products to have an add to cart button on them. ...
0
votes
2answers
387 views

AJAX call to controller returns admin dashboard html

Calling a controller with location Vendor\Orderitemstatestatus\Controller\Adminhtml\orderitemstatestatusmapping\OrderStatus.php The controller is called through AJAX from admin custom form as ...
0
votes
2answers
580 views

Change value of text field in admin form based on option selected in dropdown

I have made a custom admin form which has a drop-down. Based on the option selected in the dropdown, I want to change the value of the text field below using AJAX. In the above pic, I want to change ...
0
votes
0answers
246 views

Magento2 - How to send mail of form data using AJAX in custom form?

I have created one inquiry form in magento 2. now I want send data to given EmailID using ajax. here is my code <form> <div class="form-group"> <label for="Full Name">Full ...
1
vote
2answers
878 views

Magento 2 how to do minicart ajax update

Is there any way to update the mini cart with ajax without update button. I am using Magento 2.1.7 how to do mini cart ajax update when qty increment(+) and decrement(-) inside the mini cart, as qty ...
1
vote
1answer
377 views

Magento 2 URL to call custom controller not working

This is the default magento URL: <base URL>/magento2/multishipping/checkout/billing Now i have a custom controller i want to call this. <base URL>/magento2/multishipping/checkout/...
0
votes
0answers
73 views

Magento 2 load cart page as ajax

How I can load cart page as Ajax? I create a controller and try to show cart block like below echo $block=$this->_view->getLayout() ->createBlock('Magento\Checkout\Block\Cart') ...
1
vote
0answers
80 views

Toggle switch to change between Incl. and Exc. TAX with ajax continious loading

I've coded up a quick toggle switch which will change the price display between Including and Excluding tax using "display: none" with jQuery hide and show but i'm having problems with an Ajax ...
0
votes
1answer
448 views

How to add News Letter Subscription checkbox on checkout Success Page in Magento 2?

I am getting email address in the database with this function: protected $subscriberFactory; public function __construct( \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, ....
2
votes
0answers
34 views

Need to Initialization js while ajax response magento 2

Need to Initialization js for particular div when the div append ajax response magento 2. i have append the div in ajax response and also i need initialize js for that div. How to do that
2
votes
0answers
152 views

Initialise swatches on product list loaded over ajax

I have noticed that on my infinite scroll the swatches are not showing for products loaded over ajax. I'm guessing that similar to ajax add to cart buttons needing to be initialised the swatch ...
1
vote
0answers
254 views

How to add AJAX for the 'Add to Cart' button in wishlist page and in sidebar wishlist product in produst list page in Magento 2.2.3?

How to add AJAX for the 'Add to Cart' button in wishlist page and in sidebar wishlist product in product list page in Magento 2.2.3? Please help.
1
vote
1answer
299 views

Magento 2, error 'unserialize value' when using Ajax in phtml in admin page

Using Magento 2, Ajax in phtml, Admin. I got an error while trying to request API by ajax from template of sale order page. AJAX <script type="text/javascript"> require(['jquery', 'domReady!'],...
3
votes
1answer
2k views

Magento 2 how to Load custom collection data using Ajax

I want to display modal collection data using load more Ajax functionality, currently i am display load more data using jquery & CSS. Because for now i have a limited collection data but in ...
0
votes
1answer
281 views

Magento 2: How can I verify native captcha in a form via an ajax call to controller only?

I have an ajax customer registration form with native captcha. I am already returning ajax based response against other field validations. Only thing left is Captcha validation. Please tell me how ...
1
vote
1answer
118 views

Magento 2.2.5: How to try catch in magento with AJAX?

I'm looking for some way to try catch in Magento with AJAX and then alert the error message out. I'm following some solution but doesn't work. Ok so here is what I've done til now : C:\xampp\...
0
votes
1answer
235 views

magento ajax call to helper function

I want to call a function in a Helper file, from js file using ajax. In my config.xml <global> <helpers> <customname> <class>... In js file: jQuery....
0
votes
3answers
116 views

Magento 2.2.5: How to make javascript code run before phtml code

I am looking for some solution to make javascript run before phtml code. My work is sends width and height of my screen to controller, and it will send back to phtml file(because we cant check width ...
0
votes
1answer
33 views

Spinner Icon is not visible

I would like to display a spinner icon when the user clicks the HTML form submit button and want to hide it when the data is posted to the destination URL. But, In my case, It's not working. Below is ...
1
vote
0answers
26 views

Magento 2 : How to Use Custom AJAX Code in Admin Front End

I'm developing a delivery system for handling parcels that are handled the delivery agents. since I'm a open cart developer and new to magento, its hard for me to develop. Kindly tell me how to add ...
2
votes
0answers
74 views

Show popup when update qty in mini cart using ajax magento

When I update qty in mini cart if qty is greater than the qty of products in stock, I want to show popup "The requested quantity for ...(my product name) is not available." using AJAX. How to do that?...
1
vote
0answers
133 views

How to update Knockout using PHP window data with Ajax? - Magento 2.1

I have the following code which is working fine. I want to update coupon Name, Description and Amount based on a coupon code name change. This is my php file use Magento\Checkout\Model\...
2
votes
0answers
343 views

Upload image with Ajax in M2

In my custom module i am trying to upload images. I am able to upload images with the help of this link https://webkul.com/blog/how-to-upload-image-in-magento2/ But is there any way where we can ...
0
votes
2answers
11k views

Sending ajax POST data to controller

This is my ajax request: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ ...