Questions tagged [ajax]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
8
votes
2answers
5k views

How can I use CSRF protection with AJAX routes?

I have CSRF enabled on my install. I have a bunch of frontend forms so CSRF is pretty important for me. However, when I use AJAX to post to a controller action I get the following error. <div id="...
17
votes
3answers
7k views

How do i setup ajax paging for entries

Im looking for a good way to setup paging for new items with a simple "load more" button at the bottom. I know i'd use something like {% if craft.request.isAjax %} on the listing template to not ...
3
votes
1answer
834 views

Search Contact Person Plugin via Ajax

I'm new to Craft and I'm trying to achieve the following with a Craft Plugin A user visits my site and can input a zip code to receive the corresponding contact person's name, phonenumber and image. ...
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 ...
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 = {}; ...
2
votes
2answers
823 views

ElementAPI - Can I use javascript/ajax to load json

Probably a dumb question, but since i wasn't sure while reading on github, i'll ask here. I am wondering if I can reach the JSON I created with an URL or is it only for use in PHP? I would like to ...
6
votes
1answer
1k views

Searching a specific section by four different types of parameters?

I'll do my best to explain this. I have a Portfolio of companies, which I have as a structure, that I need to be able to filter/search through by using up to four different parameters. Keyword - a ...
3
votes
1answer
2k 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 ...
7
votes
2answers
4k views

Do I need a plugin to load entries via AJAX?

I want to load some entries via AJAX. I have a page that normally shows all entries of a specific type with user-selectable filters. I want to load filtered entries via AJAX. Do I need to create a ...
3
votes
1answer
6k 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 = ...
2
votes
2answers
953 views

Navigation with AJAX

I haven't used AJAX a lot, but what I want to do is the following: I have a top navigation that outputs entries from a structure which link to various singles that display my data. I want my ...
6
votes
2answers
2k views

Craft CMS and JS/MVVM frameworks

Does anyone have an experience in using Craft in conjunction with a front-end JS MVC/MVVM framework such as Backbone, Ember or Angular? We have a project coming up where there may be a lot of JS ...
4
votes
2answers
442 views

Is there a way to divide an entry's data into multiple subviews with unique URLs?

I have a one-level structure where I am storing a client's projects, with the ability to reorder them by dragging the entries in the structure. Each project has been designed to have multiple ...
4
votes
1answer
1k views

Front end login form with ajax

Im trying to get a front end login form to work over ajax and running into issues, it seems to always pass back success and not sure how to actual make sure the cookie gets created and the user is ...
2
votes
1answer
824 views

Ajax Post to guestEntries/saveEntries from another domain

I have a separate Craft install that I am using to communicate to a few different sites. I have a front-end form on another one of these sites (a React.js app) that is looking to post back to this ...
2
votes
1answer
992 views

How do you correctly handle errors using PT Contact Form when submitting via AJAX?

I'm trying out AJAX submission for the PT Contact Form for the first time. I've managed to get errors appearing on the frontend, but I don't feel like I'm doing it the right way. It also doens't ...
2
votes
1answer
399 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. ...
2
votes
2answers
3k views

How can I call a controller method from the front-end using ajax

I would like to call an action method from within my plugin via ajax but I am always getting a 404 response. I have a controller method that matches the ajax url: jquery $.ajax({ 'type': 'post'...
1
vote
2answers
256 views

Filter entries with AJAX

How would I sort blog entries displayed using AJAX? What I want to achieve is initially show all posts from a channel (All) but then let my users sort through these posts with a sub navigation using ...
2
votes
1answer
480 views

Updating user profile matrix block with plugin

I've written a plugin to update some user profile fields via ajax. It works great for normal text fields like this 'myWooly' field, ex: <?php namespace Craft; class ProfileUpdateController ...
1
vote
1answer
64 views

Load More Entries Button

I am trying to make my entry loop have a load more button, and not sure how to do it. I tried the method from http://craftsnippets.com/articles/infinite-scrolling-and-lazy-loading-with-craft-cms but I ...
1
vote
0answers
195 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
226 views

CSRF token is null or empty in craft 2

I'm having an issue with Craft 2.6 and the CSRF token. I enabled Csrf Protection in my general.php file by adding this line $config['*'] array so it looks like: $config['*'] = [ ... '...
1
vote
1answer
555 views

Ajax Submittions to Guest Entries

Does anything need to be done to allow for ajax submittions using the GuestEntries plugin? https://github.com/pixelandtonic/GuestEntries I'm following the method used here for Contact form, it ...
1
vote
1answer
468 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 ...
0
votes
1answer
518 views

Searching members fields [closed]

I'm building a Users search page. I want to search the members group based on the following fields that I've setup for Users: First Name Last Name Company Name (handle: genericCompany, type: Plain ...