ajax live search for post title

Here is a working solution (tested as is) The HTML (could be part of page content) <input type=”text” name=”keyword” id=”keyword” onkeyup=”fetch()”></input> <div id=”datafetch”>Search results will appear here</div> The JavaScript ( goes to your theme’s functions.php ) // add the ajax fetch js add_action( ‘wp_footer’, ‘ajax_fetch’ ); function ajax_fetch() { ?> <script type=”text/javascript”> function fetch(){ jQuery.ajax({ … Read more

AJAX handler throws 400 (Bad request) – why?

in your html add `<input name=”action” type=”hidden” value=”test_function”/>` here “value” is your “action_name”. Your ajax call is incorect. Data should be url: “your php action script” data: $(html data).serialize(), About ajax first try to create ajax on your computer without wordpress. When you understand how ajax work try on WordPress.

Click link on plugin/theme page and open the contextual help on a specific tab

Maybe the Q is bordering the off-topic, but IMO interesting in WordPress context. I’ve tested this directly in FireBug, in the Dashboard page (wp-admin/index.php). var $ =jQuery.noConflict(); // Remove ‘active’ class from all link tabs $(‘li[id^=”tab-link-“]’).each(function(){ $(this).removeClass(‘active’); }); // Hide all panels $(‘div[id^=”tab-panel-“]’).each(function(){ $(this).css(‘display’,’none’); }); // Set our desired link/panel $(‘#tab-link-help-content’).addClass(‘active’); $(‘#tab-panel-help-content’).css(‘display’,’block’); // Force click … Read more

WordPress: Sortable Metabox Fields Not Saving Position

Normally it should be enough to simply enqueue the postsbox script on a page where you want to have sortable meta boxes. Simply do the following: add_action( ‘admin_enqueue_scripts’, ‘wpse112022_postbox_enqueue’ ); function wpse112022_postbox_enqueue( $hook_suffix ) { // uncomment the next line to see what the $hook_suffix of your desired page is # var_dump( $hook_suffix ); if … Read more

jQuery and AJAX Not working with Select Form Element

instead of this: jQuery(‘#wpuf_new_post_form’).submit(function(e) { Try this way, it should work for you. jQuery(document).on(“submit”, “#wpuf_new_post_form” , (function(e)) { var data2 = jQuery(‘#wpuf_new_post_form’).serialize(); first do console.log(data2) try it, should print entire form ‘s data in console.

Add `datetimepicker` to form

You can try this. add_action( ‘wp_enqueue_scripts’, ‘wpcustom_enqueue_script’ ); function wpcustom_enqueue_script() { wp_enqueue_style( ‘datepicker-style’, ‘https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css’ ); wp_enqueue_script( ‘js-datepicker’, ‘https://code.jquery.com/ui/1.12.1/jquery-ui.js’, array(‘jquery’), null, true); } Readmore: http://jqueryui.com/datepicker/

WP set auth cookie using Ajax is not saved to browser

I assume that your custom dashboard is on a different domain/subdomain than the WordPress installation. Cookies can only be set for the current domain. Typically cookies will not work cross domain. So your dashboard cannot create a cookie for the WordPress website. Theoretically it’s possible to bypass with some server configurations, but this technique has … Read more