Stack Exchange Network

Stack Exchange network consists of 174 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]

The tag has no usage guidance.

1
vote
1answer
31 views

Craft Commerce 2 Ajax Add to Cart

Trying to ajax add to cart but each submit returns a https://www.website.com/commerce/cart/updateCart 404 (Not Found) I have this in my twig template: {% for book in craft.products().type('books')....
0
votes
0answers
16 views

Trouble with Ajax call to the Cart: CSRF token could not be verified [*SOLVED*]

[UPDATE] I've simply forget the url parameter -__-' Thanks in advance and sorry for the disturb, Davide I'm in trouble with a simple Ajax call to the cart of Craft Commerce v.1. I'm trying to delete ...
1
vote
0answers
53 views

How can I edit multiple entries via multiple front-end forms using Vue.js?

I found this post. However, writing a plugin in currently not an option, and I'd like to do this with Vue.js since I'm already using it for form validation & other stuff. Also, this involves ...
1
vote
1answer
19 views

Craft 3 Plugin Controller - returnJson() replacement?

In Craft2, when making an ajax request to a plugin controller action, you would use the returnJson() method which is part of the BaseController class - which your plugin controllers extend. This sets ...
0
votes
2answers
26 views

Does Craft save dates in the locale format?

I have a website with multiple locales (English, Dutch, French, German and Spanish). I'm saving dates on a front-end form through Ajax, but it seems that Craft saves the dates in the locales' format, ...
1
vote
2answers
31 views

Sprout forms AJAX submission giving Template not found

I am able to capture submissions from a regular HTML form, however if I replicate the POST with JSON I get the following "Template not found" error. Template not found: sprout-forms/entries/save-...
1
vote
1answer
72 views

Another AJAX CSRF question

I have quite a simple registration form, something like this: <script type="text/javascript"> window.csrfTokenName = "{{ craft.config.get('csrfTokenName') }}"; window....
1
vote
1answer
58 views

CSRF Protection in AJAX post

I'm having some trouble passing CSRF-tokens in my js-File in Craft 3. I'm setting the values in my template like so: <script type="text/javascript"> window.csrfTokenName = "{{ craft.app....
2
votes
1answer
97 views

Ajax Load more Posts

On my blog i need a load more button on the bottom of each section that simply loads more posts when clicked. Everything i look at people are using other javascript libraries. I just want to use ajax ...
1
vote
1answer
36 views

How can I call console controllers

I have a controller in the console folder. How can I call this controller via ajax please? I tried to config a route in Routes.php, and then call this route by jquery Get() function. But none of ...
0
votes
0answers
20 views

Ajax search depending on user

So i need to implement ajax with my search, basically auto populating as you type. I need it to auto populate entries, channels and structures. However i need to ONLY show certain results if the user ...
0
votes
0answers
10 views

ElementIndex hangs on elements.onBeforeBuildElementsQuery

I am trying to modify the ElementCriteriaModel from my plugin when loading the elementIndex on /entries of the control panel. My plugin consists of some access-restricting code to block access to ...
2
votes
1answer
77 views

Ajax not updating user image

I have ajax submitting my form everything works except the user image. It works without ajax but not sure why it's not working with ajax. My ajax is and form are shown below. <form method="post" ...
0
votes
0answers
153 views

CSRF Cookie isn't getting set in certain browsers

Seems like Chrome (67) will not set the CSRF cookie, which breaks all of my ajax requests. The CSRF tokens are not cached This is still an issue when caching is turned off This works when CSRF is ...
1
vote
2answers
84 views

Ajax User registration sometimes forbidden 403 error [closed]

I am experiencing a very weird issue. I have a simple user registration form: <form method="post" action="" accept-charset="UTF-8" id="addTeacherForm"> {{ csrfInput() }} <input type=...
1
vote
0answers
81 views

Refresh “hidden” template after login with ajax

I am trying to create a seamless user login interaction with a modal form using ajax. Let's say I have a navigation template _navigation.html <div> {% if currentUser %} {{ currentUser }}...
1
vote
1answer
563 views

Axios post function got 400 bad request

I created a Vue component. And in this component, I use axios to send post request when it's mounted, CSRF token also included, but still got 400 status. Anyone know why?
0
votes
1answer
92 views

Ajax query filter for entries

I'm attempting to set up ajax filtering for entries using jquery. I'm setting variables in my js based on form field values. The js is triggerd when there's a change in a form field and then the ajax ...
2
votes
1answer
247 views

Contact Form AJAX not working in Craft 3

This is my first Craft website, and after trying out Craft 2 I decided it would be a good idea to have move my site to Craft 3 for longevity. I used to the free Contact Form plugin and managed to ...
0
votes
0answers
326 views

Loading scripts after using an ajax request to load new elements

After successfully loading the elements in a popup, I noticed that the scripts doesn't load/execute (like slick.js, isotop.js ...) external scripts, I did some research but all what they did is ...
1
vote
1answer
202 views

Load new entry(s) in the same page with ajax as a popup

First time I'm going to use Ajax with Craft CMS therefore I'm still confused how it works. What I need is this, when I click on a specified link in the front, I need the CMS to load some entry/...
1
vote
1answer
257 views

When to hide show more button

I am use a load more button in place of pagination. I just using jquery and ajax using this post as a starting point. The problem I'm having is how to hide the button when there is no more posts to ...
1
vote
1answer
140 views

Filter entries by ajax to controller

Short story: I need your help sending value from dropdown selection as data to controller so my div updates with the filtered entries based on the selection. Long story and code: I have a listing of ...
1
vote
1answer
54 views

Ajax - How to create a Category through actionTrigger

I'm trying to create a jQuery/Ajax script to import data from a Wordpress API service and want to import the WP categories and tags into my database. I've managed to import the tags using an Ajax call ...
1
vote
1answer
46 views

Ajax - Create tag with custom ID programatically

I'm trying to create an jQuery/Ajax script to import data from a Wordpress API service and want to import the WP tags into my database. Everything works as expected when I loop through the data and ...
3
votes
1answer
589 views

Basic ajax - how to?

I am new to Craft. I have done some ajax in the distant past. I have searched this forum and see lots of issues with ajax but it seems that there are a lot of different approaches. Craft docs have ...
1
vote
2answers
203 views

How can I create a zip file containing all assets from an entry gallery?

I'm trying to create a download button which will allow the user to quickly download all assets in an entries image gallery. I've started by adding each image url into an array stored in a data attr ...
0
votes
1answer
153 views

Ajax pagination not loading last entries if not equal to pagination number

I've got ajax working on a page but if the number of articles is not exactly 3 (this is the pagination limit) then the remaining 1 or 2 entries do not get loaded. I'm not sure why or how to resolve ...
1
vote
1answer
57 views

load include not until its needed

I have created an infinite loop by crossreferencing two includes to each other. On one page. My aim is to load pop up layers on a page (teachers and instruments) and have links to each other. {# ...
1
vote
1answer
342 views

How to set up a social media feed with vue and axios

What I need is a social media stream with posts with the Hashtag mnbasel form Instagram, Facebook and Twitter. I couldn’t find any good tutorial. Hopefully someone can tell me what I miss or lead me ...
2
votes
1answer
199 views

Hidden files are no longer accessible with AJAX in Craft 3

I'm not sure if this is a bug, a security feature, or something to do with Twig 2; but since Craft 3 (RC3) I'm no longer able to access hidden twig files via ajax. This works fine: $.ajax({ ...
0
votes
0answers
326 views

Contact form to send email and sign up to MailChimp list

I'm trying to create a contact form that includes a subscribe checkbox which will sign the user up to a MailChimp list. I've been using the craft plugin ContactForm and have found this MailChimp ...
2
votes
1answer
157 views

Solspace Freeform plugin: AJAX without jQuery – how?

I am trying to post data using AJAX. The docs describes a method here. But that is mainly for jQuery. I have also looked at this url, which also uses jQuery. But from what I understand, the "action"...
1
vote
1answer
887 views

Craft 3 - ajax request to plugin

This is a pretty simple test before I implement some larger functionality. Eventually this will be just a glorified upload form via ajax. Part 1 - Ajax post $.ajax({ type: 'POST', ...
1
vote
3answers
698 views

Contact Form plugin - using Ajax, CSRF 400 bad request

I am using the Contact Form plugin with AJAX. I have used the JS AJAX script supplied in the plugin but i get a 'Bad request: CSRF token could not be verified' error. I have seen many other posts on ...
1
vote
2answers
233 views

Saving new entry via Ajax then immediately showing it

I’ve created a very simple comments system whereby comments are set us a channel, with each (comment )entry related to a main entry from another section. Works fine. I’ve set up editing and deleting ...
2
votes
1answer
886 views

JQuery $.ajax “:success” form logic with Plugin Controller?

I'm working on a simple plugin to facilitate front-end, anonymous lead generation forms submitted to Salesforce via cURL to it's Web-to-Lead servlet. The logic and data transfer are working (debug ...
1
vote
1answer
476 views

Simple AJAX search form

So I've been following the docs on how to create a search form in Craft and it works fine. But instead of having a results.twig page I would like to have just one index page and get all the results ...
0
votes
0answers
303 views

AJAX REQUEST Success but doesn't give the right response

In my page, I have a button that will perform an AJAX call pointing to a controller This is the data that that ajax call is passing: objDataAsset = { assetTypes: [], asset_summary: 1, ...
1
vote
0answers
331 views

How to access logged in CSRF token?

I’m currently using react as a font end SPA with craft cms as the backend. I’m trying to create user accounts where a user use can sign up and favourite content on the site, using the Like for craft ...
0
votes
1answer
129 views

Dynamic entries limit via dropdown

On a entries (listing) page I'm using pagination and a fixed limit of entries set. I want visitors to be able to select (dropdown) the number of entries that should be listed (limit). I'm not a Java ...
1
vote
1answer
202 views

Ajax Submit with AM Forms - How To

Is it possible to submit to an AM Forms form via Ajax? I cannot find anything in the docs? Is there a tutorial somewhere?
1
vote
2answers
186 views

Update Commerce Cart using Fetch

Hi this is a variation of the question asked here on updating the cart using ajax, instead I'm attempting to use the Fetch API. As a test the form submits properly when submitting in the usual way ...
1
vote
1answer
485 views

Ajax call to action 404

I've a trigger on my frontend that requires an action. I've started from the businessLogic template but I'm getting a 404 and can't find why. My function public function actionExampleAjax() { ...
1
vote
0answers
55 views

Include with AJAX

I am fighting since days with this situation: I have a Select field with around 150 item and depending on a selected item a list of icons and names should be shown (around 50). The list of items (...
1
vote
2answers
91 views

How to update front end Craft new row - stuck on JavaScript

I'm building out a front end entry form with a Natrix and everything is coming along fine. However when users create a new row each new row needs to be unique in order to be saved. This is where I'm ...
1
vote
1answer
69 views

Guest Entries plugin will only submit when logged in - not anonymously (via AJAX)

I am trying to create an entry in a section via AJAX from the front end when not logged in. I am using the 'Guest Entries' plug in for craft to do this. The entries are all the same and consist of ...
1
vote
3answers
301 views

Craft CMS plugin with AJAX gives 404 error

I have created a small craft cms plugin to pull some information from the DB, and everytime I execute the plugin I get a 404. Here is the controller namespace Craft; class ...
5
votes
2answers
257 views

Possible to change locale in PHP?

I've got a plugin which is defaulting to English during AJAX calls, but I need it to stick to whatever the current language is. I can send the current locale through via AJAX data, but I'm not sure ...
1
vote
1answer
526 views

Error 404 When trying to POST to plugin Controller action

Before I dive into my problem, I do want to mention that I did do my due diligence and spent the last two days researching this problem, to no avail, so here it goes: So I'm getting the following ...