Null/undefined return in WordPress AJAX request

I am not sure the output you have provided is the correct one but do you notice the ‘0’ character at the end of your string? {“title”:”R=3+”,”dates”:[“06\/04\/2014″,”11\/05\/2014″,”15\/06\/2014″,”27\/07\/2014″,”17\/08\/2014″,”28\/09\/2014″,”05\/10\/2014″,”19\/10\/2014″,”09\/11\/2014″,”23\/11\/2014″,”14\/12\/2014″],”series”:[{“data”:[[1396738800000,284],[1399762800000,350],[1402786800000,212],[1406415600000,296],[1408230000000,220],[1411858800000,253],[1412463600000,200],[1413673200000,310],[1415491200000,180],[1416700800000,156],[1418515200000,290]],”name”:”Bulls”}]}0 That is enough to cause the JSON parser to fail. Also, don’t use the contentType property like that since you don’t send any JSON, you should remove that … Read more

jQuery(selector) vs. $(selector)

This is because of jQuery noConflict wrappers. It is certainly not an oversight by WordPress developers; but rather, a great little way to ensure we (developers) can hook our own javascript files or libraries without conflicting with other javascript code. Be sure to read the Codex on jQuery noConflict Wrappers. The usage pretty much depends … Read more

Can’t add classes using jQuery from a JSON string with get_body_class()

get_body_class() is going to return an array of classes, which is then (per code not published in your question) JSON encoded into that comma separated string. While you can manipulate that in JavaScript, the easiest thing to do is implode the string before encoding: $c = get_body_class(‘project’); $c = implode($c,’ ‘); You should have a … Read more

Multiple selec2.js file loaded by several plugins

is this normal that each plugins has its own version ? If the script isn’t registered by Core there isn’t much else a plugin/theme can do but register the script itself. If would be nice if there were some standardization, but that would be a tricky problem to solve. what could be the issue for … Read more

Multiple Media uploader output to input

As per comments try collecting the ids in an array and then setting the text field once: custom_uploader.on(‘select’, function() { var selection = custom_uploader.state().get(‘selection’); var ids = selection.map( function (attachment) { return attachment.id; }); $(“#media-input”).val(ids.join(‘,’)); });

JQuery UI not loading without explicit loading of jQuery

jQuery and the jQuery UI Slider are both registered by default by WordPress. In order to use them, all you should need to do is something like this: add_action( ‘wp_enqueue_scripts’, ‘wpse192997_load_slider’ ); function wpse192997_load_slider() { wp_enqueue_script( ‘jquery’ ); wp_enqueue_script( ‘jquery-ui-slider’ ); } Note, though, that WordPress uses jQuery in noConflict mode, which means that the … Read more

Checking length of string in an admin area field onblur with jQuery

There are a number of issues with your code but most importantly you need to call val on the text input. Here is how your make_year_created_equal_4_chars function might look: function make_year_created_equal_4_chars() { ?> <script type=”text/javascript”> // This is a shorthand for “jQuery(document).ready()” jQuery(function($) { $(‘#acf-field-artwork_created’).blur(function() { // Please notice the declaration of ‘selected_length’. // It … Read more

Admin Ajax is returning 0 and not Insert data

A 0 status from admin-ajax.php indicates that no “action” is being parsed. When you enqueue the script you are assigning a handle, this handle needs to be used when you use wp_localize_script and additionally you need to assign the url. https://codex.wordpress.org/Function_Reference/wp_localize_script wp_register_script( ‘some_handle’, ‘path/to/myscript.js’ ); wp_localize_script( ‘some_handle’, ‘object_name’, array( ‘ajax_url’ => admin_url( ‘admin-ajax.php’ ) ); … Read more

Change zurb foundation top bar style on.scroll in wordpress theme using jquery and css

You need to fully reference jQuery throughout your code. It should be… jQuery(window).on(“scroll”, function() { if(jQuery(window).scrollTop() > 50) { jQuery(“.top-bar”).addClass(“active”); } else { jQuery(“.top-bar”).removeClass(“active”); } }); When in no-conflict mode you need to always reference jQuery in full and not use the $. No conflict mode exists to prevent conflicts when jQuery is used with … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)