Upload data from weather station to WordPress Website

This is a pretty good application of WordPress’s REST API, which would enable you to update the data via a POST request containing the new data in JSON format and poll for changes with GET requests to the same endpoint. While you could establish this functionality with traditional AJAX request handlers, I think it makes … Read more

How to use ajax to get multiple outputs?

Instead of passing two parameters to function you can pass the array of two values like this : $results[‘args1’] = “value1”; $results[‘args2’] = “value2”; echo json_encode($results); and then get it in success function like this : success:function(results){ jQuery(“.semester_selection1”).append(results.args1); // This appends value1 jQuery(“.semester_selection2”).append(results.args2); // This appends value2 }

Add Ajax to rating button

I’ll only outline how to do it since there are plenty of answers on this site that address how AJAX works in WordPress. Just check out the ajax tag. Yes, you’ll need some javascript to watch for when the button is clicked. When it is, you send a custom action, say ‘myaction’, and the post … Read more

Ajax function not returning any results

Regarding the jQuery part: Everything looks OK, except for the fact that we have no way of knowing which URL you are ultimately pointing to. You could see the URL, the headers you’re sending and the server’s response by using Firebug or WebKit’s developer tools in Chrome or Safari, and editing the code accordingly. Since … Read more

Specify ABSPATH in jQuery url

If your JavaScript is running in the admin, you don’t need to set an explicit path to admin-ajax.php. It’s always available as a JS variable called “ajaxurl”. You can see an example of this in the Codex, under the heading “AJAX on the Administration Side” Ajaxurl is, unfortunately, not available on the frontend by default. … Read more

update_option is not saving an array, but saving the string ‘Array’

It sounds like your array isn’t being serialized before updating the option for whatever reason. Perhaps due to ajax or just your particular situation. Try this: // … $option[ ‘apps’ ][] = $new_app; if( ! is_serialized( $option ) ) $option = maybe_serialize( $option ); $data = update_option( ‘vm_fbconnect’, $option ); // …

Creating an auto result search bar

Then “autoSearch.php” has this code: If that’s all there is, no wonder you get an error – WP isn’t even loaded! Add this to your functions.php isset( $_POST[‘autoSearch’] ) && add_action( ‘after_setup_theme’, ‘wpse_60353_autosearch’ ); function wpse_60353_autosearch() { // The autoSearch.php code you posted in your question exit; // All done, stop WP continuing } Now … Read more