Questions tagged [ajax]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3
votes
0answers
122 views

How can my plugin use Craft's native dragdrop support

I am using a generic Garnish modal from Craft like so: $container = $('.upload-modal'); $modal = new Garnish.Modal($container, { autoShow: false }); I would like to have craft's native drag&...
2
votes
2answers
792 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 ...
3
votes
1answer
950 views

Access data when posting to controller from front-end

I'm writing a plugin to notify authors when a Disqus comment is posted. There is a Disqus JS callback you can use to hook into this, so I'm doing the following on the front-end: this.callbacks....
4
votes
1answer
3k views

How to load entry-objects with Ajax

I should begin to say that I have no idea really how exactly ajax works. Although I've used it a couple of times with pre-made WordPress plugins. I saw some examples of ajax entry-loading here on ...
1
vote
1answer
2k views

Crossdomain ajax request to controller with requireAjaxRequest()

I make request from my localhost(gulp server) to example domain in to VerifyPassword controller. When i make request without headers: {'X-Requested-With': 'XMLHttpRequest'}, It comes as expected 400 ...
1
vote
1answer
134 views

Formerly - Checking if e-mail already entered

So, I have a form created using formerly and their template. The form works fine, but I am trying to check for duplicate e-mails and just stop a submission when it notices there is one in the system. ...
1
vote
1answer
931 views

Get entry by slug with EntriesService in ElementAPI

I'm looking to get all entries from one section (say 'videos'), that are related to a specific category. The only reference to the category is the slug that is a parameter in the url: ....dev/videos/...
0
votes
1answer
122 views

How do I prevent a runPendingTask script being included in returned HTML via ajax? [closed]

I have created a route to retrieve some categories via AJAX. When the AJAX call returns the HTML a runPendingTask script is also returned with the HTML. How do I prevent this? /*<![CDATA[*/ (...
0
votes
1answer
797 views

Template for submit via ajax to Guest Entries plugin

I am a bit mystified by how to utilize templates for Guest entries plugin working fine for normal post saving custom fields. When I use ajax to submit I get an XHR 200 response but an HTML response - ...
2
votes
1answer
810 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
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'...
0
votes
1answer
146 views

Is it possible to load different “_layouts” with ajax for certain pages?

I've followed this tutorial by Zack Spear. It leaves your website with a header and footer that stay constant while the body of the page is loaded in through AJAX when you change pages. Is it ...
2
votes
1answer
191 views

Front-end form submission feedback on buttons

I have some front-end forms including login and sign up which are modal windows. Currently I have no feedback for the user if they are successful or not. What's the best method to return something in ...
2
votes
1answer
508 views

How to create a secondary menu to filter entries?

I have a page where by default it lists all of the entries inside the section 'work'. I'd like to have a secondary menu where I can filter these entries by the field 'projectCategories'. {% ...
3
votes
2answers
3k views

What is the best way to append CSRF token without using a form?

I have built a plugin that simply makes requests to a 3rd party API. I am calling my plugin action via ajax. I don't have a form on this page currently. Here is what I am using, but I am getting the ...
2
votes
1answer
884 views

AJAX page transitions with history.pushState

I'm a new craft user (previous EE user). trying to follow Zack Spear's directions (https://designbycosmic.com/journal/craft-cms-ajax-page-transitions-with-history-pushstate) for how to setup Ajax page ...
1
vote
0answers
2k views

How to get a param from an ajax request in twig?

Ok this has been puzzling me for too long now! I have some code that makes an ajax request: reqAjax: { type: 'get', url: '/mytemplatefolder/myfile.html', data: {town: 'bournemouth'} } ...
4
votes
1answer
3k views

Call plugin controller from frontend with ajax

I want to send an automatic back office email when user click on a button (to request support) on frontend. Then I just display a confirmation message (we ll get back to you shortly). So I made a ...
3
votes
2answers
541 views

Loading related entries by category using a select menu

I have a list of people (entries) who are related to Categories. I would like to create select menu which will change (filter) the people (entries) shown on the page depending on which category (...
2
votes
1answer
896 views

How to check for new entries periodically from the front-end?

I would like to check periodically (every 5 seconds for example) whether there are new entries in a channel. If yes, I would like to present a refresh button on the website (with the number of the new ...
2
votes
2answers
1k views

How do I get the current user’s info over Ajax?

I created an Ajax-based login form based on this gist: https://gist.github.com/keithmancuso/29e8446ec5fa66fb2b01. After the user has logged in, how can I get some info about them over Ajax?
1
vote
1answer
999 views

Plugin Controller Ajax Request

I've got a custom controller in my plugin that checks whether or not the request is ajax or not, using craft()->request->isAjaxRequest() In the event that it is, I just want it to return a ...
2
votes
1answer
1k views

Sort / Order Entries on select or button click

I have a page on my website were I display alot of entries. Now I want those entries to be sorted by Date, Title etc. I know how to change that hard coded but I want to make it dynamic with a <...
2
votes
1answer
165 views

ajax call breaking onBeforeSaveUser

I have a plugin that has an onBeforeSaveUser event. This fires the mailchimpsubscribe plugin to subscribe users to selected newsletters. Everything works correctly the user is subscribed and then the ...
2
votes
1answer
468 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 ...
2
votes
1answer
490 views

Using ajax with routes is it right?

So doing some entries loading via ajax from this question which I expanded on. https://craftcms.stackexchange.com/a/9868/3579 I'm curious about setting up a route for the actual ajax file since it ...
3
votes
1answer
353 views

Load correct language Ajax

I'm having a problem with my ajax-loading when I'm on the english version of my page (My main language is Norwegian). I have a file named loadmore.html that I'm loading in on index.html when pressing ...
1
vote
1answer
228 views

Delete plugin record via ajax

I have been staring at this SE post on deleting using ajax and it's just not clicking. For example, I have a plugin with a list of users. Each user has a delete icon next to it. template .... <...
4
votes
2answers
847 views

Twig Filter in Plugin/PHP?

Is it possible to access twig filters in a plugin? I want to be able to preview how text will look in a textarea using Markdown for a discussion board, it'd be awesome to use ajax to send the content ...
6
votes
1answer
1k views

Ajax front-end user registration form - not returning JSON

I have a user registration form on the front-end of a site that is working well as a standard form, but when I try to use ajax submission, I'm getting an HTML response rather than JSON. Here's the ...
1
vote
2answers
1k views

Change profile in frontend with ajax

I'm trying to update some checkbox fields through the frontend with ajax. After clicking / change of the checkbox the form needs to update the profile. Template code: <form class="form-...
6
votes
1answer
837 views

Delete items from frontend with ajax

I'm trying to delete items through the frontend with ajax. It's working now but want to be sure if this is a safe method: $(".delete-file").click(function(){ var data = { entryId: $(this)....
2
votes
1answer
987 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 ...
1
vote
1answer
198 views

Updating index tables' sortable attributes on AJAX

I'm currently writing a plugin enabling users to easily add custom fields to index tables, using the native field layout designer. My current goal is to have any datetime, boolean, string or number ...
1
vote
1answer
842 views

Submit via ajax to Guest Entries plugin

I'm trying to submit entry data via AJAX (using Guest Entries plugin) following what's written in a similar question, however even though I am not sending the data in JSON format, the data does not ...
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 ...
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="...
5
votes
3answers
745 views

How can I set the HTTP status code?

I'm trying to set a 404 HTTP status response code for an ajax controller action in a plugin. Yii has a response object where the code can be set, but I can't find a way to access it from craft.
0
votes
1answer
504 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 ...
2
votes
2answers
947 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 ...
4
votes
2answers
438 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 ...
3
votes
1answer
803 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. ...
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
807 views

Change user password on the front end

I'm building a profile page for members on a site where members can change their password. I'm sending the request with ajax, and can successfully change password if I have the input name "password" ...
1
vote
1answer
548 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 ...
4
votes
3answers
775 views

P&T Contact Form plugin: How to display error messages in other languages via Ajax

The validations error message get displayed in main language instead of being translated, you can try here (contact form at bottom): http://lequartiergeneral.be/en/ The form is being displayed and ...
1
vote
1answer
506 views

How can you retrieve entries with a specific locale in a plugin?

I have this: $this->requireAjaxRequest(); $segments = craft()->request->getActionSegments(); $lang = $segments[2]; $entryId = $segments[3]; $entry = craft()->entries->getEntryById( ...
2
votes
1answer
739 views

How can you use the jQuery pjax plugin with Craft?

There is a jQuery plugin called pjax (https://github.com/defunkt/jquery-pjax/) for downloading page content via ajax. How can you integrate pjax in Craft for downloading entries via ajax? Or are ...
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 ...
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 ...