jQuery ajax call throws an HTTP 302

I’d say, just skip that: cookie: encodeURIComponent(document.cookie) There’s no need to post any cookies on XHR – the browser handles that. Well, how about something like that instead (untested): data:{‘term’:encodeURIComponent($.term)} Most easy is to use FireBug, open Net panel and inspect both HTTP headers.

Plugin for a text modal box [closed]

Fancybox works great for displaying content as well as images or videos. To display content, use something like: $.fancybox(‘<h1>My html content here</h1>’, { fancyOption: ‘fancyValue’ }); This functionality is documented on fancybox’s How To page. You can also use fancybox the same way you do for a link to an image, only for a link … Read more

Are there any scripts, classes, and/or functions built-in to WP for a plugin to export/import its saved data from wp_options?

The only native import/export facility is the one under Tools in the admin. And even that needs an extension (plugin) for importing from different formats. It’s pretty straightforward to build one yourself. Something along the lines of: $options = get_my_options(); header( ‘Content-disposition: attachment; filename=my_export.txt’ ); header( ‘Content-Type: text/plain’ ); echo json_encode( $options ); exit; And … Read more

Intergrating agile carousel to wordpress: how to write the ajax_callback function

So I see you’re referring and attempting to recreate this example: <link rel=”stylesheet” href=”https://wordpress.stackexchange.com/questions/63304/agile_carousel.css”> <script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.js”></script> <script src=”agile_carousel/agile_carousel.a1.1.js”></script> <script> // Code used for “Flavor 2” example (above) $.getJSON(“agile_carousel/agile_carousel_data.php”, function(data) { $(document).ready(function(){ $(“#flavor_2”).agile_carousel({ // required settings carousel_data: data, carousel_outer_height: 330, carousel_height: 230, slide_height: 230, carousel_outer_width: 480, slide_width: 480, // end required settings transition_type: “fade”, transition_time: 600, … Read more

Ajaxify calendar

Write your required javascript, then use this code to display it on the page, it ensures that the script is only included if the calendar is displayed add_filter(‘get_calendar’, ‘add_calendar_scripts’); function add_calendar_scripts($content) { add_action( ‘wp_footer’, ‘output_calendar_scripts’, 11); return $content; } function output_calendar_scripts() { ?> <script type=”text/javascript” src=”https://wordpress.stackexchange.com/questions/70078/<?php echo get_template_directory_uri();?>/path/to/script.js”></script> <?php }

Adding a slider captcha to the comment system

First things first, there is quite a bit of _doing_it_wrong() in the script enqueueing. Don’t override core-bundled scripts Try removing this hook callback, and see if that fixes things: function my_scripts_method() { wp_deregister_script( ‘jquery’ ); wp_deregister_script( ‘jquery ui’ ); wp_register_script( ‘jquery’, ‘http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js’); wp_register_script( ‘jquery ui’, ‘https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js’); wp_enqueue_script( ‘jquery’ ); wp_enqueue_script( ‘jquery ui’ ); } add_action(‘wp_enqueue_scripts’, … Read more

HTML editor accessing quicktag buttons

I wrote a jQuery plugin to check every 0.5 seconds if the toolbar has the requested element. (function( $ ) { /** * Wait until element has finish loading requested elements, then execute callback * @param string element Element to wait for * @param object callback Callback to execute * @param integer timeout Optional timeout … Read more