Questions tagged [ajax]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
263 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
335 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
664 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
82 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
130 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
118 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
537 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
340 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
799 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 ...
1
vote
0answers
130 views

Need help with filtering entries by a custom field using ajax with pagination

I'm fairly new to CraftCMS and am stuck with a little filtering issue. I'm trying to filter a page of entries by a custom field. I'd like to use Ajax so there is no page reload. Here's how I have the ...
1
vote
0answers
96 views

SquareBit Charge Plugin: How to retrieve error messages from failed ajax call?

This is a continuation of How could I submit the Charge plugin using Ajax? I'm using the Charge plugin to handle my Stripe payments. I'm having to use ajax to submit the charge form before submitting ...
1
vote
0answers
44 views

Find category through ajax using ElementCriteriaModel

I'm trying to run a controller action with ajax in a new plugin I'm making. The action needs to return all categories from a group, so nothing impossible here. When I run the actionUrl in the ...
2
votes
1answer
805 views

Element API + JSON data in template

Is there any way to include the JSON response from element API in a template. Let's take the following example: /case-studies.json returns: { data: [ { title: "American ...
1
vote
1answer
335 views

AJAX user registration and JSON returned

I am using business logic plugin to tap into save user event and create some profile field values. public function init(){ parent::init(); craft()->on('users.saveUser', function(Event $...
2
votes
1answer
770 views

AJAX reload include template

I'm working on getting our site set up with Craft Commerce, and I am currently working on a sidebar cart for the site. I've found examples on how to add products to the cart using AJAX and jQuery and ...
1
vote
0answers
141 views

Submit Dropdown with ajax

This works for me, but i would like to solve this with ajax without reloading the page. Choosing the values from the Dropdowns and submit the data per POST Method, so i can return the value with "...
2
votes
1answer
391 views

AJAX Front-end User Registration Form not displaying macro errorList

I have a user registration form on my Front-end which is submitted with Ajax which works fine. The only problem is that if I have any errors, like an already in use username they wont be displayed. ...
1
vote
1answer
900 views

Update cart lineItems through ajax

How do I update the lineItems after I submit the form through ajax? right now it adds the item, but it doesn't show up in the cart, it only shows up when I reload the page. I am adding an item to ...
1
vote
1answer
77 views

Access optimizedTitle field within Twig template

I'm trying to access the value set for my optimized title within Sprout SEO. I've had a read through this page: https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/advanced-customization/...
2
votes
2answers
956 views

Craft Commerce ajax add to cart, missing information

I add items to my cart using ajax, following the code from this post Update Commerce Cart using Ajax But there are some things missing in the cart object returned on success, they are : The URL of ...
2
votes
1answer
960 views

Complete working example for adding Craft Commerce items to the cart using AJAX and jQuery?

I'm using Craft Commerce and every time I click the Add to Cart button for a product, I'm redirected to the Cart page. This works okay, but I'd like to use AJAX (with jQuery v1.12.4) for this to save ...
0
votes
1answer
2k views

Update a user image on the front end using Vue.js and Ajax

Following on from this question I am now looking at adding, deleting and updating a user's image on the front end using Vue.js and vue-resource. I have the delete functionality working no problem but ...
1
vote
1answer
158 views

Guest Entries - Two ajax forms for different section entries. Receiving 404 only on second form?

I am using the guestentries plugin to create two different section entries. I have two similar html forms on the same front end page. They both use the jquery validate plugin before submiting via ajax....
10
votes
5answers
12k views

Updating a user on the front end with Vue.js and Axios

I currently have a working profile update form using purely craft but I would like to now enhance that using Vue and Axios to update via Ajax. I may well submit a couple of questions rather than put ...
1
vote
1answer
2k views

Using pagination with Ajax load.. help need on JS

I am using a template which has a 'LOAD MORE' button beneath a grid of entries (entries 1-10). Click this link loads addition content to the grid via AJAX from another page (which contains entries 11-...
0
votes
1answer
162 views

Commerce - Ajax returning obj.success even when failed

I've got a basic jQuery script that I use to update the cart, either through the actions /actions/commerce/cart/updateCart (if product isn't in cart yet) or /actions/commerce/cart/updateLineItem (if ...
0
votes
0answers
2k views

CSRF token could not be verified - ajax

I've got a Craft plugin that returns some results based on filter options on the front end. The filter sends an ajax submissions and returns the markup to populate the front end with. I've read the ...
2
votes
1answer
90 views

Trying to replace an asset via replaceFile action in entry form

UPDATE: We've resolved this one. Here is the working code: <form method="post" enctype="multipart/form-data" action="" accept-charset="UTF-8"> <input type="hidden" name="entryId" value="{{ ...
0
votes
1answer
568 views

Can't get correct template for ajax call

Background: I've inherited a site built in craft that has a page called "updates" with a button to load additional entries through ajax. The updates page is an entry in the "page" structure and when ...
1
vote
1answer
389 views

Displaying assets from Craft's cart AJAX response

So, I'm currently building out an eCommerce site for a client. I'm adding products to the cart via AJAX. I'm then sliding out a 'Cart' view panel with the current cart contents, which is being updated ...
1
vote
1answer
145 views

Tags via AJAX actionTrigger

I pretty much followed this and the answer there really helped me a lot so far. Currently I'm stuck with either a 500 (Internal Server Error) or a 400 (Bad Request) Error. My craft/storage/runtime/...
0
votes
1answer
98 views

Handling dynamic content

I would like to be able retrieve all entries based on a category selected in a drop down list. From a UX perspective, I would like this to be as seamless as possible and not have to do full page ...
5
votes
1answer
2k views

Update Commerce Cart using Ajax

Is there a way to update the cart using ajax? I've tried something like: $('span.quick-cart-add>p>a').click(function(e){ e.preventDefault(); var data = {}; ...
1
vote
3answers
274 views

How to get user's information when registering or logging in via ajax form

I did search for this but was unable to find the documentation for getting user's data on a return when logging them in from a front-end facing login form (I need to do the same for a registration as ...
0
votes
1answer
351 views

Craft and AJAX page transitions - how to exclude local hash links from executing AJAX? [closed]

I've got a website in development with new pages loaded via AJAX instead of traditional page loads. Most links on the site will use AJAX to load a new page, however there are some links I need to ...
1
vote
1answer
1k views

Ajax Function on a search form not working in Safari & IE

I made an ajax function so my page wont refresh and my search window wont disappear on form submit. It works fine in all browsers but it keeps refreshing on Safari. Here is my code: {% if not craft....
1
vote
1answer
93 views

Save the form if not complete and come back another time to complete the form

I am using the FormBuilder plugin and I want users to be able to fill in a form. If they abandon the form without completing it or submitting it, I want the form to be saved and when they login and ...
2
votes
1answer
382 views

Creating a guest entry, with a Matrix field, using Ajax

I'm trying to submit a guest entry by building a javascript array of objects to mimic a form submission and submit using ajax. I've managed to successfully submit the entry with just a title but when ...
2
votes
2answers
962 views

500 Internal Server Error in OpenShift install

I'm running into a 500 Internal Server Error when trying to install craft (on openshift). Environment: Platform: OpenShift (nginx-php7 cartridge: https://github.com/pinodex/openshift-cartridge-nginx-...
2
votes
2answers
1k views

How to do an ajax submission to Craft Contact Form with attachments using FormData?

JS .on('submit', '#application-form', function(e) { e.preventDefault(); var form = $(this), formData = new FormData(form[0]), msgBox = form.find('.msg-box'), ...
1
vote
1answer
465 views

Unknown error occurs on every AJAX call in CP

I was working on a plugin with a hook on onBeforeSaveEntry in my dev environment (which is configured exactly like my live environment). I had a var_dump with an exit in the hook to check output of ...
2
votes
1answer
3k views

How do I add meta data and a page title through ajax?

I have looked a lot through this StackExchange but I guess I am not too advanced in using AJAX/Json. My aim is to have page transitions using Ajax. This was rather easy to accomplish following this ...
2
votes
3answers
374 views

Triggering JavaScript from back-end event

I'm building a plugin and want to trigger some JavaScript on an event being fired (eg an entry being saved). What is the best way to achieve this? Coming up short looking through the documentation and ...
2
votes
2answers
540 views

How can I use Ajax function in Craft CMS?

I want to do an autocomplete search engine on my website. But I don't know how to use Ajax in Craft CMS. How can I set an Ajax function in Craft CMS templating? The search engine must have dynamic ...
2
votes
1answer
2k views

if isAjax not working or not detecting ajax request in template

I can't stand this and have to ask for help again.. Still working on my buddy's website. I want to increase a entry's counter (using Entry Count plugin) So for my _entry.html I added an if statement ...
1
vote
1answer
561 views

Ajax layout sample

I am just learning how to use this CMS and I am able to get basic things done but I have no idea what a ajax layout will look like. I have few pages in old system which fetch info using ajax calls (....
6
votes
3answers
1k views

Refreshing meta data when using AJAX page transitions

I have created AJAX page transitions based on: https://designbycosmic.com/journal/craft-cms-ajax-page-transitions-with-history-pushstate It's all working nicely, the main content of the site (...
3
votes
3answers
4k views

Is it possible to update a Twig variable based on user interaction without page refresh?

I'm currently trying to use the excellent "Charge" plugin to set up a simple Stripe checkout form for charity donations. The basic example provided in the docs works nicely. <form method="post">...
2
votes
1answer
862 views

How do I get started with Element API plugin?

I'd like to use the Element API plugin. I've follow the instructions mentioned here: ElementAPI - Can I use javascript/ajax to load json Here is my config/elementapi.php file : <?php namespace ...
3
votes
1answer
5k views

How to load entries via ajax when a filter is clicked?

I have a page that lists all entries from the section 'work'. I would like the user to be able to filter these entries by category but via ajax so I don't have to go to a new page. {% set entries = ...