Problem running Ajax in WordPress

1: the codex recommends enqueing all scripts and styles on the wp_enqueue_scripts() hook. this won’t solve the problem, but is good practice. 2: i think that all the data that goes INTO the php function is wrapped up in $_POST. which is sent by the .ajax call. so it doesn’t look like you are sending … Read more

AJAX post into pop-up div

Your code is not clear as it is out of context but it looks to me like you are loading your posts pages over AJAX through their normal URLs– URLs like http://example.com/this-is-a-post/ or http://example.com/2012/12/01/this-is-a-post/. The drawback to doing that you are loading the entire WordPress and theme framework into your popup, which may be much … Read more

Ajax not returning anything on form submit

Shortcodes are too late to add ajax actions. Additionally, that actions would be added only if shortcode is executed, which is very unlikely to happen on a ajax request. The quickest way to make your code work is to move the add_action outside addimage() function. add_action( ‘wp_ajax_wp_up’, ‘wp_up’ ); add_action( ‘wp_ajax_nopriv_wp_up’, ‘wp_up’); function wp_up() { … Read more

Jquery ajax to custom php file: returning blank data

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 and points to admin-ajax.php … Read more