Tag Info

New answers tagged

-1

I believe one of the comments should fix your issue given how you mentioned that the code works outside of WordPress, which does in fact appear to be a problem with your references to $ instead of jQuery. Also, i have written a post on this exact topic with step by step instruction, you can see it here: Ajax Calls in WordPress


0

First of all when I want to make a AJAX code I start the ajax registering by adding a ajax url accessible from the js. wp_localize_script( "combo_checkout_iRange", "server_obj", array( "ajax_url"=>admin_url("admin-ajax.php") ) ); Than from the javascript file I could call the ajax server like that: jQuery.post(server_obj.ajax_url, ...


3

You use globals :( whenever you think that you need to use a global you should automatically stop coding and invest as much time as it takes to remove that need. In your case it seems like you assume that global variables persist between Ajax request, but they don't. In addition your design of the code is broken as in client server configuration you can not ...


0

CDNs, remote resources and cross origin requests You might want to replace the http: for your CDNs first. It could be that there are cross origin request problems when using that. Omitting the protocol allows the browser to chose the right protocol depending on the situation. The fixed protocol often is a problem in Chrome - the "overprotective parent". ...


0

Try: wp_enqueue_script( 'nevermind-navigation', get_template_directory_uri() . '/js/navigation.js', array('jquery') ); It is possible that jQuery is not enqueued, and you are not declaring it as a dependency for your script. Being logged in, automatically enqueues jQuery. EDIT: Console log says jQuery is not defined. Did you add a ...


0

This code here is the problem- $('.slider-menu li').on('click', function(e) { e.preventDefault(); var slide_index = $('a', this).attr('href').substr(6) - 1; $homeSlider.flexslider(slide_index); return false; // IE9 hack }); In your html, you're setting your IDs to slide plus the attachment ID, then telling flexslider to animate to that ...


1

I think you are missing the point here about dependency. If the dependency parameter has been set when registering or enqueueing a style or script, that style or script will wait in queue for the style or script it is dependent on to load. This particular script or style will not load until the script or style it is dependant on is fully loaded. Now, if you ...


0

.active class of flexslider is not specific to WordPress, so off-topic here. BTW, a simple WP_Query(), get_posts(), get_children() etc. never affects the flexslider performance. What you have to follow is the syntax provided by the flexslider. Please note: <div class="flexslider"> <ul class="slides"> //loop starts <li> ...


1

You are going on the wrong way.This will create difficulties and is NOT WORDPRESS STANDARD.Wordpress has a ajax technique to implement this. Call the ajax from your page <script> var data = { 'action': 'insert_data_customtable', 'first_name': firstname, 'last_name': lastname }; // since 2.8 ajaxurl is always defined in the admin header ...


2

You're sending your AJAX request to the wrong place. Of course calling functions.php directly will get you undefined function errors, because the WordPress API isn't loaded by functions.php ( it's the other way round ). A car doesn't make fuel go forward, fuel makes a car go forward, simply getting in the car won't make fuel magically appear, in the same ...


1

WordPress gets delivered with jQuery. All you have to do is tell your theme to wp_enqueue_script() jQuery: wp_enqueue_script( 'jquery' ); This code belongs into your functions.php. Of course, you can also change which version of jQuery should be loaded, and from which ressource, check this thread for further details. Afterwards you can put your ...


0

I know this is a bit old, but seems to come up a lot. I am sorry to say mate, but you and the wordpress team are the ones who are _doing_it_wrong() (I'm only talking about the front-end part of things, not the admin panel) First of all, it is not safe to always use the latest jQuery cause things can change and people don't always (read: very rarely) update ...


0

This is old but for anyone else reading this question, don't use github as it won't work. <?php /** * Plugin Name: Add JQuery Chosen Quickly * Plugin URI: http://wordpress.stackexchange.com/questions/85824/ * Description: Test/Add chosen to site without adding any files * Version: 1.0 */ function enqueue_chosen_jquery() { wp_register_style( ...



Top 50 recent answers are included