$.load()
is used to load content into an element. And you need to send a ping/request to a url, don’t need to use what is returned/responded. So, $.post()
or $.get()
the the solution for this.
$.get('', 'wpfpaction=add&postid=350');
Usage With the current post id –
$.get('', 'wpfpaction=add&postid=<?php the_ID(); ?>');
To dynamically add it from functions.php, you will need to hook on wp_footer
add_action('wp_footer', 'wpf_on_the_footer');
function wpf_on_the_footer()
{
if( is_single () ) ?>
<script type="text/javascript">
$.get('', 'wpfpaction=add&postid=<?php the_ID(); ?>');
</script>
<?php
}
Related Posts:
- How to set time delay in javascript
- Disable button in jQuery
- JavaScript: filter() for Objects
- Is jQuery $.browser Deprecated?
- jQuery date formatting
- $ versus jQuery
- How to center image in carousel
- Enable & Disable a Div and its elements in Javascript
- Which selector do I need to select an option by its text?
- How to pass $(this) properly in click jQuery function
- How to remove specific value from array using jQuery
- Check if inputs are empty using jQuery
- how to remove default jquery and add js in footer?
- CSS not pulling in for jQuery UI dialog
- Check if jquery library exist
- Loading style.css and Jquery using HTTPS
- Access Customizer’s DOM – jQuery
- Media manager multiple selection
- Uncaught TypeError: Cannot read property ‘replace’ of undefined
- Is it worth updating WP admin to jQuery 1.5?
- How to include jQuery properly?
- Ajax not firing properly using Firefox, but works in Chrome
- How to load whole WordPress pages dynamically with AJAX/jQuery like this following website?
- Adding jQuery dependency prevents my script from enqueuing/loading
- Creating custom AJAX requests
- How to pass jQuery ajax URL value
- trigger(‘change’) not working
- how to get the comment ID in the front end when the REPLY button is clicked?
- Gravity list field override and adding javascript [closed]
- Change header image loaded by jQuery to use HTTPS
- Admin wp_ajax hook returning 0
- Automatic jQuery accordion from header tags
- Need To Deregister Scripts Via Functions.Php
- Add a Fancybox automatically to post type “post” images
- Uncaught TypeError: jQuery is not a function
- WordPress customizer refresh screen after save
- Creating multiple enclosing shortcodes and fixing JS issues on click
- Include jQuery plugin in WordPress
- Hide metabox dependant on page template chosen
- Trying to remove duplicate jquery scripts
- How to make an WordPress element sticky? [closed]
- Frontend Post with JQuery AJAX to Php Issue
- show/hide div with simple jQuery script [closed]
- How do I remove WordPress Custom Menus hover event and replace it with jQuery onclick?
- How to get all users by custom current user meta (array)?
- wp_dequeue_script not working in my plugin
- Trouble adding inline style after jQuery in the footer!
- jQuery script isn’t posting to database
- $.browser Undefined Seemingly Causing Faulty Page Display
- I’m trying to set the cookie to my site to button on click action ,it is working on when user logged in .When user logged out it’s not working
- Invoking Jquery in a Plugin
- Loading scripts on a single page plants the script in the footer
- registering new jQuery after wp_deregister_script() not working
- jQuery Show DIV and Remove Button [closed]
- timeouts (ERR_CONNECTION_RESET) on seemingly random files after upgrading to HTTPS
- Required radio button does not validate in form, when clicked through Javascript/jQuery
- Moving jQuery to footer from header
- jQuery plugin not loading
- Flexslider won’t work with WordPress’ jQuery | Dependencies
- Applying jquery to WordPress admin edit.php
- Load different post_thumbnail for smaller window width (jQuery,WordPress)
- Duplicate “default” form with jQuery
- Search query with Ajax
- admin ajax php success returns 0
- Parse wordpress blog data using json api and ajax
- JQuery Issues With WordPress Theme Interface
- problems with jquery external rss feed integration
- wp_enqueue_script calling jQuery at different times for different browsers?
- AJAX calendar navigation returns -1
- A carousel slideshow plugin in JavaScript
- Axis guidelines over an image
- Retrive username of the loged in user using jquery
- How to setup multi-page using jquery?
- $ not defined using jQuery in WordPress
- Get with jQuery the value of an ACF field
- I want to run Sql Query in script how can i do this
- error: n.imagesLoaded is not a function
- WordPress forbidden 403 on delete in production vs local environment
- jquery Autocomplete
- How to change event in slider
- Get ajaxForm response value
- Update a parent theme JQuery property in the child theme
- jQuery search function not running in WordPress but running locally (fiddle)
- Refresh widget admin page resetting jQuery hidden class
- Autocomplete for titles via ajax – rework of past post away from like_escape()
- Can’t seem to get JQuery working (wordpress plugin)
- Ajax Request with jQuery not happening
- Console shows ReferenceError: jQuery is not defined, no clue why!
- slide change on hover with nextgen scrollgallery [closed]
- Sorting UL Listing Within the TinyMCE Visual Editor in WordPress
- How to make jQuery load AFTER plugin’s script?
- jQuery not working internal pages [duplicate]
- jQuery .change() Event Bubbling in WP Admin
- My .js file is getting a 404
- Unable to understand this jquery code [closed]
- Combo box populating a DIV using ajax/jquery
- How to Add jQuery cod in wordpress [duplicate]
- can’t make jQuery work (change image on time interval) [closed]
- Contact Form 7 – Submit Form not working After Ajax Request [closed]
- Making the Google Maps API non readable