Variable not being returned from Ajax Javascript (though javascript receives it)

The AJAX callback doesn’t take any parameters, you have to get them from the request using $_GET/$_POST/$_REQUEST (depending on how you have your javascript set up). This means that to get get mix_name from your POST you would use $_POST[‘mix_name’]. Including the add_action( ‘wp_ajax_… calls from your code would be good if you have future … Read more

Add php function into .js file (for tinyMCE button)

To ajax this function you have hook it, so your function will be like this : function write_cat_list($cat){ $cats = get_categories(‘hide_empty=0’); if($cats) : $tinyMCE_list = array(); foreach ($cats as $cat) : $tinyMCE_list[] = array( ‘text’ => $cat->name , ‘value’ => $cat->term_id ); //write_cat_list($cat->term_id); endforeach; $jscode = json_encode($tinyMCE_list); //to convert from array to opject echo $jscode; … Read more

How to use different jquery function of idangero swiper dependant on page template?

You should really learn how to use debug mode in WordPress. You should go and read this page: Debugging WordPress. The reason being is this line of code add_action( ‘wp_footer’, ‘print__my_inline_script’ ); If you had debug enabled, you would have seen a message like this Warning: call_user_func_array() expects parameter 1 to be a valid callback, … Read more

Ajax autocomplete based on usercode

You could fill in the form as shown below: inputs = document.getElementsByTagName(‘input’); for (index = 0; index < inputs.length; ++index) { // assign inputs[index] element values from the response. } This is pure JavaScript, unless I miss something.

Dynamic image grid gallery

If you visit your website and view the page source, look for that file you are trying to include, if you cant find it, then you know you have not loaded it correctly. If you can find it, check the path is correct. This way you make 100% sure it is being referenced and is … Read more

Using AJAX in WordPress Widget

AJAX/jQuery is not limited to any specific “area” like plugins or widgets, in fact some plugins consist solely of widgets (although afaik the converse cannot be said). This Smashing article might be a good primer. When you finish with that then check out Gary Cao’s WordPress + AJAX tips and come back with a more … Read more