Try adding return false;
to prevent the default submit action of the click.
$('.grp_getnew').on('click', function(){
var data = {
action: 'get_random_post_tu',
usecategory: $('#categoryselect').val()
};
$.post( ajax_object.ajax_url, data, function(response) {
if ( response.status != 'error' ) {
var $link = $("<a href="" + response.link + "">" + response.title + "</a><span >" + response.content +"</span>");
$('.grp_content').html($link);
}
}, "json");
return false;
});
Related Posts:
- Query Posts by Custom Field ‘Price’
- Why get_posts() not returning only selected category posts from Custom Post Type?
- AJAX search posts and pages
- Using AJAX to generate front end / viewer end pages
- woocommerce search by sku and title ajax
- Only return taxonomies that are linked to a category & product
- User Following System
- Query Custom Post Types on Available Dates
- Shipping Refund via Stripe Creates New Order Instead of Updating Original Order
- Possible to replicate economist.com’s debate section in wordpress? [closed]
- WP_Query ordering numbers as letters
- FacetWP group listings by custom field [closed]
- WordPress Ajax Callback
- plugin ajax to external php file always return null
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- How can i list random post from multiple category?
- how do i remove posts from a WP_Query so the pagination is right?
- WP plugins for building a database?
- WooCommerce get_price returning wrong price when used via ajax
- Shortcode button dosent work for all posts. Work for first post only
- Loco Translate: Custom Post and Custom Taxonomy Labels not translated in wp-admin menu
- Accessing post’s meta data based on user’s click of a post
- WordPress category add image field
- AJAX button run function
- Where (or when) should I register a new taxonomy?
- WooCommerce shop page orderby [closed]
- Limit Number of Taxonomy Terms (Images) Displayed
- Widget for adding HTML markup to a page
- When to use action hooks and plugins
- How I can get custom field’s current value?
- Simple ajax call not working in wordpress plugin
- Filtering WP_Query Dynamically on the Front-End
- Get posts from WP_Query and format them on admin_head
- Not getting author rank when using return
- How to query the custom fields by language?
- Form isn’t inserting data into database with ajax plugin
- How do I “get the next 10 posts after post_id == x”?
- Want wp_get_post_terms return in arbitrarily order, how to do?
- What’s the best way to implement AJAX in WordPress?
- How to Create a Custom Panel and Fields in Post Page [Plugin]
- How to put JQuery/Ajax inside shortcode?
- switched from query_posts to WP_query, not working now?
- WordPress Ajax Posting from App
- List taxonomy terms for post as checkboxes
- __callStatic method handler passed to add_action causes bug in PHP
- Using a custom plugin to capture input data via Ajax and PHP
- DROP TABLE with uninstall hook not working
- Ajax contact form widget plugin data not insert in database
- woocommerce_package_rates not fired when wordpress woocommerce accessed as non ajax
- Theme is Causing Ajax Conflicts for a plugin I cant identify it
- ‘No Results Found’ on single post for custom post type
- Why WordPress plugin url ajax doesn’t work?
- How to change this WP_Query to get all ProductIDs and not only specific one?
- wordpress, search form using ajax
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- jquery not calling php function
- Search for categories
- auto populate list of questions if user select a category xyz
- AJAX in plugin wp_send_json() sending html
- Best place for if/else piece of code related to custom plugin?
- Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content
- How to call WordPress function other files
- 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
- WP_Query and NULL meta keys
- Ajax Search Lite: Customize Autoscroll
- admin-ajax.php warning max input vars exceeded on layered pop plugins [closed]
- How to set taxonomy in custom plugin?
- how to use in custom single.php template using php?
- WP_Terms_List_Table Quick Edit not working
- 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
- Create tabs in admin options page from custom post type loop
- 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
- WordPress page and plugin list using sql query
- Display wordpress post’s in popup?
- How to create a custom shortcode based on the layout?
- Using color picker in plugin, does input attribute order matter?
- How to handle cookies from a WordPress plugin on a cached page?
- “Custom Post Type Permalinks” plugin URL strcuture
- Ajax : Call undefined function plugin_function() … can’t call any plugin function
- Ordering taxonomies by rank
- wordpress file upload with ajax when site is ajaxyfi
- Post Comments with Ajax in WordPress
- AJAX search as you type? [duplicate]
- Plugin generated taxonomies’ permalinks with custom placeholders
- WordPress api call using wp-ajax returns error 400
- AJAX call – failling to call do_action
- Retrieve custom post types by custom taxonomies with WP_Query
- how to insert data in wordpress table usnig jquery ajax
- WooCommerce search products between price range using WP_Query
- Using wpdb without loading all plug-ins via wp-load.php
- ACF: post query, hide duplicate values [closed]
- What are the Best Practises When Using AJAX in Plugin Development?