Questions tagged [ajax]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
2answers
949 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-...
3
votes
0answers
121 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&...
1
vote
1answer
460 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
2answers
779 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 ...
2
votes
1answer
2k 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
361 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
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
554 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 (...
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 ...
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
797 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 = ...
3
votes
1answer
933 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....
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
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-...
0
votes
1answer
119 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
782 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
801 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 ...
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
190 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
495 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'. {% ...
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
534 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
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?
2
votes
1answer
873 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 ...
1
vote
1answer
989 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
164 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
462 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 ...
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 ...
2
votes
1answer
487 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 ...
17
votes
3answers
6k 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
349 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
223 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 .... <...
2
votes
1answer
983 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 ...
6
votes
1answer
830 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)....
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
837 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 ...
0
votes
1answer
498 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
939 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
432 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
800 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" ...
4
votes
3answers
771 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
545 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
503 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
735 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 ...
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 ...