Can I include Javascript/jQuery in a page?

You need to make sure that jQuery is loaded, so that you can use it. In functions.php: function namespace_enqueue_scripts() { if ( is_page( ‘slug-of-new-page-you-are-creating’ ) ) wp_enqueue_script(‘jquery’); } add_action( ‘wp_enqueue_scripts’, ‘namespace_enqueue_scripts’ );

How can I check email exists via a jquery keyup()?

I would use an AJAX request to a PHP script that does the lookup, which might look something like this on the jQuery side after document ready: // jquery $(‘#email-input’).live(‘change’, function() { //ajax request $.ajax({ url: “email_check.php”, data: { ’email’ : $(‘#email-input’).val() }, dataType: ‘json’, success: function(data) { if(data.result) { alert(‘Email exists!’); } else { … Read more

How to get a value from PHP in Jquery through Ajax

You are passing ‘readen_color’ as the action parameter, but you’ve defined the ajax action as ‘mark_as_read’. Try this: $.post(ajaxurl, { action:’mark_as_read’, post_id: iPostId }, function (response) { console.log(response); }); And as for your PHP: add_action( ‘wp_ajax_mark_as_read’, array( &$this, ‘readen_color’ ) ); // Add no_priv if you want users not logged in to be able to … Read more

jQuery UI inside widget on admin page

Ok, so, for some reason I can’t comprehend, the answer is that the div element containing the tabs should have a class and not an id for jQuery UI to work properly, as such: <div class=”mytabs”> and jQuery(document).ready(function($) { $(“.mytabs”).tabs(); }); Just for the record, the way I enqued the scripts is: add_action( ‘admin_enqueue_scripts’, ‘load_my_admin_js’ … Read more