Hot answers tagged

5

You can do this if you're willing to programmatically manipulate hidden configuration variables in your config file ;-) I use Focus Labs Master Config style configs, so I have this in my dev config: $env_config['template_debugging'] = 'y'; $env_config['show_profiler'] = 'y'; And, obviously, you can set those to 'n' by-hand to turn off the debugger ...


4

You can avoid the XID validation by making a GET request instead of a POST request. XID validation only occurs when secure_forms is y and the $_POST array is not empty. Or you can generate a valid XID hash by using {XID_HASH} in your template. Maybe something like: <body data-xid="{XID_HASH}"> <script> $.post( 'site/inifinite_scroll_ajax', ...


4

This works for logging into ExpressionEngine with ajax and showing the appropriate error, you would just modify the code where it checks for the error messages it returns to display to the user. You will need more conditions for the required fields. function displayAjaxMessage(message, response_id) { if(typeof(response_id)==="undefined") response_id = "#...


4

After some guidance from Ahmad Saad below (thanks Ahmad!) I was able to get shipping (and total) calculated after shipping method change. First it will require to change template where shipping form field is located. That part is required due to default shipping value is not loaded when new cart created (in my case). My looks like: <tr> <td>...


4

ExpressionEngine has a protection against Cross-site Request Forgery - CSRF and a documentation available here. You just have to add that line to your form: <input type="hidden" name="csrf_token" value="{csrf_token}"> And send the data in your AJAX request. I had the same problem today and that fixed it for me.


3

Honestly, I wouldn't even mess with that plugin since that's what it's supposed to do. Just do a simple ajax call and append the data like this. Note the move of #articles to the main template, and paginate_base parameter in the embed template. Main Template <html> <head></head> <body> <section id="articles"> ...


3

I wouldn't recommend this but in cases where you have no choice, e.g. you cannot tweak the code in an app in time or something to that effect, you can opt to conditionally disable secure forms in your config.php or bootstrap. E.g. // Make an exception to make AJAX forms app-compatible // EE 2.7.x introduced mandatory XIDs even for AJAX, but an app won't ...


3

I don't think so unless you write a plugin to access the code in the DB. However you could easily create a hidden template IE ( _parsed_data.html). Then AJAX load it in to your to your current template using Jquery AJAX .load(). $("div#parsedData").load("{site_url}/templategroup/_parsed_data.html"); You can also with javascript depending on how you ...


3

Create a hidden template that is just the logged in username only. Then load it in via jquery ajax .load(); Once login is complete as well. if (event.success) { member_favourites = "5"; //do something $("div#username").load("_username.html"); }


2

Do you have Process form data in Secure Mode? set to "Yes" in your Security and Session Preferences? That could be your issue. If you do, then EE will give a "The action you have requested is invalid." error message instead of using your template, and you'll never be able to get your POST data. I tried your code and it works as long as Process form data in ...


2

You can use send_ajax_response() which will return JSON and works well for response to ajax requests. For your example you'd do public function mealDates() { $array = array( 'foo' => 'bar', ); return $ee()->output->send_ajax_response($array); }


2

Use stash to cache the results (refresh every x minutes, overwrite=no) for fast access. Chain your ajax request, and use channel:entries limit and offset parameters (e.g. after the first 50 return, hand them to map handler and call same/next ajax with new offset) Option 2 will do several requests in a row, which might not be what you want. edit: example ...


2

The documentation code is an example, and therefore may need tweaking for fit your particular goals. File fields are different from "regular" fields, since no text or data is present inside the field when submitting, as you would have it with text fields for example. The above code simply serializes the form's text data to be sent through ajax, and ...


2

Move the click handler to the wrapping div. $('#cal_container').on('click', '#prev, #next', function(event) { event.preventDefault(); /* Act on the event */ }); Has to do with the original event handler in your code not being passed to the dynamically inserted html. There's a good explanation found here: http://toddmotto.com/attaching-event-...


2

I checked and I can see the XID param being sent to the jquery.ajax by looking in chrome network panel, i can see the query string it builds. So we are good there. It sounds like you are sending the XID in GET instead of POST data. CSRF tokens must be present in the POST data if POST data is received by ExpressionEngine. 2.7.3: POST: XID 2.8+: POST: ...


2

...and also a checkbox that will show whether the user has completed that resource You can't store the member choices in the channel entries information. Well, technically you could, but it would have to store every members details so not optimal and not recommended. I'm assuming there could be a crossover - so 2 courses could share the same resource. So ...


2

I usually do all of my AJAX form submissions with the jquery ajax form plugin. This allows you to customize the experience for your users here is the link to the plugin its very simple to implement. http://malsup.com/jquery/form/ Hope this helps!


2

Two approaches come to mind, the first is to load everything (all results) and only show X at a time (JavaScript) based on your own custom pagination or lazy loading effect. But that means you'd still be sending to the browser all the raw html initially, so might have performance issues. How channel:entries works with the limit parameter in ExpressionEngine ...


2

EE doesn't have a native API interface to communicate with, but I've been having quite a good time with Webservice API plugin from Reinos, and with it you can turn a EE install into a REST/XMLRPC/SOAP server. They've also done the hard work of connecting with many third-party add-ons. Check out the docs here.


1

Don't use the curly brackets and quotes on the segment in your conditional. Write your conditional like this: {if segment_2 == ""} Edit: your closing div for entry-container is missing the last character. Your link tags should be in de head of the document The final script tag is not closed.


1

AJAX Auth is supported and compatible with latest EE versions. If you need support or have pre-sales questions, email me directly to support@intoeetive.com


1

I'll post my answer from my comment above down here. FreeMember is a great, free plugin that allows some flexibility.


1

I ran into the same problem. After talking to EE support, they informed me I'd need to update the meta hidden field as well if I wanted to update the entry, instead of creating a new one. The meta hidden field is an encrypted string representing the settings for the form. This includes the entry_id, so if the meta value isn't updated, it posts a new entry ...


1

This actually has little to do with the workings of Low Alphabet itself. Rather, it's a JavaScript question, along with some smart templating to allow for proper ajax requests. Steps to take: Create 2 templates: 1 for the full page, and 1 just for the low_alphabet:entries tag. Embed the latter in the former, but make sure the second template is also ...


1

If a Google map is being "revealed" with Javascript then it is necessary to trigger the map resize event when it is displayed. If you're using Google Maps for ExpressionEngine then there is GmapHelper which you can grab and call at the appropriate time to fire the resize event.


1

Try this, and instead of hiding output2 after the dom has loaded add style="display:none;" to #output2 in the html. $(document).ready(function() { var options = { target: '#output2', // target element(s) to be updated with server response beforeSubmit: showRequest, // pre-submit callback success: showResponse ...


1

as answer for your last update change your code to : $(document).ready(function() { $("#shipping_method").change(function() { var url = $(this.form).attr('action'); var p_data = $(this.form).serialize(); $.post(url, p_data , function(data) { var new_shipping = $('<div />').append(data).find('#oso').html(); ...


1

I tested this and it works just fine. Be sure to include the title input with valid data. If you're still having trouble, be sure to check the console log data object. If you dig around you'll probably find the pertinent error. <!DOCTYPE html> <html> <head> ... </head> <body> {exp:channel:form channel="your_channel" json="yes"} ...


1

You could probably load in http://ee-zoo.com/docs/visitor/examples/forgot_password.html dynamically with Ajax into another template with relative ease. Perhaps you could adjust http://ee-zoo.com/docs/visitor/examples/login_ajax.html and call it in at an appropriate time. If that's not quite right for you, could you clarify what you're after with the ajax ...


1

Try: $helpful.find(".ajax-response").load(link, function(response, status, xhr) { $helpful.find(".voters").hide(); $helpful.find(".ajax-response").html(response.message); }); Ajax submissions return a JSON array as a response. You need the correct key (in this case .message) in this array to display only text. Another method for general-purpose ...


Only top voted, non community-wiki answers of a minimum length are eligible