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
- What’s the preferred method of writing AJAX-enabled plugins?
- How to add a shortcode button to the TinyMCE editor?
- how to include other plugins css files in a shortcode?
- What characters are allowed as a shortcode tag and how should they be sanitized?
- Autogenerate wordpress shortcodes using array?
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- AJAX Call Via Vanilla JavaScript In WordPress Plugin Development
- Ajax Load More and Masonry: is it possible to load admin-ajax.php in the front end?
- How to save Clicks of a download link button while it doesn’t matter if we refresh the page or again login/logout
- ‘Lazy loading’ list of posts with pagination
- How to include admin-ajax when loading external javascript
- do_shortcode() doesn’t work if shortcode contained in variable, works if shortcode passed as string
- wp_specialchars and wp_specialchars_decode in a shortcode plugin
- How to create popup same as wordpress popup feature
- Overriding Attributes values in Shortcode Plugins
- Check if email address exists front end with AJAX in a plugin
- Confused about shortcode and settings values
- Running jquery script after shortcode [closed]
- Where to call add_shortcode function in WordPress Plugin Boilerplate?
- WooCommerce get_price returning wrong price when used via ajax
- Adding Shortcode to Text Widget
- AJAX search posts and pages
- wordpress, search form using ajax
- Search for categories
- Best place for if/else piece of code related to custom plugin?
- Best place for short bio,image and button [closed]
- WordPress Integration with Google Groups
- Best place to load wp_ajax_the_ajax_hook action in plugin
- jQuery.post not working within shortcode – WordPress Ajax
- get_post_title is not working on homepage
- How can I inject options into an select tag inside the widget form?
- Init plugin again after ajax call finish
- How to create a custom shortcode based on the layout?
- Using color picker in plugin, does input attribute order matter?
- How do I apply style to each category of a list?
- AJAX call – failling to call do_action
- AJAX fileupload – TypeError: not a function ajaxSubmit()
- Displayed content disappears when adding attributes to shortcode
- How do I pass custom shortcode-extracted variables (taxonomy) into a query function for WordPress RoyalSlider?
- How to display checked posts on another page over AJAX? (like comparasion style)
- where do I send my ajax calls
- Using WordPress to build membership Page
- Function call in wordpress short code handler fails
- strange shortcode error: does shortcodes requires any dependency?
- wp_localize_script not passing the data
- Get post content from outside the loop with plugin shortcode usability
- WordPress API functions not working at AJAX functions.php call
- Passing PHP Variables to AJAX Loaded Pages
- wp_ajax action responds with 0
- Why AJAX response 0!
- Is there any way to inject text onto pages?
- Create Short code dynamically
- Get variable value based on string constant
- AJAX call inside plugin class is not getting to it’s response function
- WordPress load same script two times
- How do I reinit WordPress plugins dynamically using jS?
- how to display a template.php in a shortcode
- Get a value from a shortcode for another function
- How to call function in WordPress on button click?
- Hide content for specific users with id
- using WPPB shortcodes without the plugin
- save short-code in my custom plugin settings problem missed something
- WordPress ajax error 400 bad request for sending data to remote site [duplicate]
- Do_shortcode before send email content
- Ajax call to php function doesn’t work PHP code
- Compare Ajax Data Results
- Frontend AJAX Request causes Error: ‘Call to undefined function add_action’
- Ajax Load More on Hierarchical Categories
- Meta box or shortcode help
- Creating new option (add_option) from AJAX – Settings API
- WordPress Feedback popup with date saved into table
- How to limit each front-end user to view just his own uploaded files on Amazon S3?
- WordPress ajax not working in registration
- AJAX login without a plugin does not work. when add a action to function.php
- Call/Run a Mathematica (.m) Shell Script from WordPress Page/Blog
- AJAX doesn’t pass variables to the php function in the plugin
- How to use shortcode of any plugin to show it visually where i want?
- How to Set Limit with WordPress Get Bookmarks Shortcode
- Plugin constructor called multiple times
- My AJAX API plugin isn’t working
- ajax sends data to plugin
- How to use ‘Event Manager Shortcodes’ plugin via the php code? [closed]
- WordPress shortcode plugin not working
- WP Customer Reviews call short code on another page [closed]
- Shortcode returning specific content of a post
- Jquery post responses 500 error after some time and lastly an 503 error
- Ajax button “Load more” is not loading correct language version posts for logged out users
- How can I get the permalink of a page on which shortcode has been used
- wordpress admin-ajax bad request 400