You are not using ajax right. Why are you adding your ajax callback function to the init action? You need to read http://codex.wordpress.org/AJAX_in_Plugins
Attach your ajax callback function to wp_ajax_your_defined_action
like this:
add_action( 'wp_ajax_your_defined_action', 'your_callbck_function' );
For this to work you have to use wp-admin/admin-ajax.php as your ajax url and you have to post your_defined_action to action.
$.ajax({
type: 'POST',
url: ajaxurl, //This is defined only on admin side
data: {
action: 'your_defined_action',
some_var: 'Some Var Content'
},
success: function (response) {
alert(response);
}
});
Related Posts:
- Loading shortcode with ajax
- Calling shortcode in wp_localize_script strips result
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- Shortcode in AJAX popup
- How to put JQuery/Ajax inside shortcode?
- Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content
- Render Modula Plugin Shortcode On Ajax Request
- plugin shortcode not working on ajax request call
- grab or load text on demand
- JS working when used normally but not in wordpress
- Get shortcode attribute for AJAX call
- Best place for if/else piece of code related to custom plugin?
- Nested shortcode functions accessing variable
- Calling an attribute from a plugin shortcode
- Best place for short bio,image and button [closed]
- Insert content of a post into another
- Ajax call returning 0
- Ajax with plugins returns 0
- WordPress + JavaScipt + AJAX + MySQL: insert query for form
- Ajax fail and get 504 error
- Ajax Search Lite: Customize Autoscroll
- admin-ajax.php warning max input vars exceeded on layered pop plugins [closed]
- WordPress Integration with Google Groups
- accessing wp.media api from a tinymce plugin
- Best place to load wp_ajax_the_ajax_hook action in plugin
- jQuery.post not working within shortcode – WordPress Ajax
- Create tabs in admin options page from custom post type loop
- Creating shortcodes in plugin
- Visual Composer shortcode for child theme dir
- get_post_title is not working on homepage
- Some code in shortcode function being ignored
- How to load wp_editor via AJAX
- How can I inject options into an select tag inside the widget form?
- Init plugin again after ajax call finish
- Display wordpress post’s in popup?
- How to create a custom shortcode based on the layout?
- Using AJAX to generate front end / viewer end pages
- Using color picker in plugin, does input attribute order matter?
- How to handle cookies from a WordPress plugin on a cached page?
- Ajax : Call undefined function plugin_function() … can’t call any plugin function
- wordpress file upload with ajax when site is ajaxyfi
- Unable to add TAB character to post?
- Post Comments with Ajax in WordPress
- AJAX search as you type? [duplicate]
- plugin shortcode output
- How to Create a shortcode to this php function
- Inject HTML meta tag inside wordpress tag using add_shortcode
- WordPress api call using wp-ajax returns error 400
- How do I apply style to each category of a list?
- Create shortcode to echo javascript
- AJAX call – failling to call do_action
- how to insert data in wordpress table usnig jquery ajax
- Using wpdb without loading all plug-ins via wp-load.php
- What are the Best Practises When Using AJAX in Plugin Development?
- Redirect to another page using contact form 7? [closed]
- What is @Action in WordPress?
- Custom Shortcode Broken in WordPress 3.1
- Use $_GET inside a shortcode print empty Array
- Namespaced shortcode?
- Admin AJAX doesn’t work in plugin admin page – Even though code is copied verbatim from WordPress Codex
- Where are theme codes located for WordPress?
- AJAX fileupload – TypeError: not a function ajaxSubmit()
- Call plugin with php function
- My plugin won’t return anything [closed]
- Anyway to convert a plugin to become a shortcode?
- Shortcode to update user meta
- AJAX on Front-End Button Click not working – Custom Plugin
- How to handle WordPress Plugin Front-end AJAX Call [duplicate]
- Why shortcode always displayed after footer not in body
- Does having more than 30 Admin Ajax affects site performance (plugin)?
- How to have sample page for each new register users in a membership website
- How can I run a custom shortcode function on a live site and only run if the viewer is a specific machine?
- Submit Form data to another page via Ajax (WordPress Way)
- using do_shortcode
- Why am I unable to load scripts in head in plugin?
- AJAX Load more start with x posts
- How to add a dvi tag to a shortcode then change a generated text using jQuery
- Deactivate JS Script in Plugin Shortcode
- Is it safe to use admin-ajax.php in the frontend?
- Displayed content disappears when adding attributes to shortcode
- Modify page title and subtitle with a plugin
- How do I pass custom shortcode-extracted variables (taxonomy) into a query function for WordPress RoyalSlider?
- Where to find the code used to render a page that has a shortcode and a template defined?
- Shortcode not working after move wordpress website files
- wordpress add_action() issue in ajax call
- Shortcode not getting replaced
- How to display checked posts on another page over AJAX? (like comparasion style)
- How to activate a plugin on the activation of a theme?
- Add Shortcode tag in Widget/Sidebar
- Flipping Book PHP Code? Any experience?
- Create WordPress posts from JSON array using plugin in admin
- PHP script from functions php is loaded via admin-ajax to div…and the result is 0, not the desired content
- Ajax Plugin Not Echoing Response
- Adding inside wp-plugin jQuery script that receives JSON-formatted data, generated by php-function inside this plugin
- where do I send my ajax calls
- WPTouch – how to remove shortcodes or make shortcodes function
- convert more tag to shortcode
- Ajax save data to database on document ready, no data being saved
- Shortcode does not expand in Facebook like
- WordPress front end AJAX. Return 0 :?