Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is included with WordPress, and available to both themes and plugin developers.
1
vote
1
answer
2k
views
class click counter save number
"/js/counter.js", array('jquery'));
wp_localize_script('my-ajax-handle', 'the_ajax_script', array('ajaxurl' =>admin_url('admin-ajax.php')));
}
add_action("wp_enqueue_scripts", "js_enqueue_scripts"); … function set_button_count(){
$counterFile = 'counter.txt' ;
// jQuery ajax request is sent here
if ( isset($_POST['increase']) )
{
if ( ( $counter = @file_get_contents($counterFile) ) === false …
1
vote
class click counter save number
counter.js
jQuery(document).on('click','.counter',function(e){
testAjax(the_ajax_script.ajaxurl);
});
function testAjax(link) {
$.ajax({
url: link,
type: 'post',
data: {
'action … ': 'set_button_count',
'increase' : '1'
},
success: function(data) {
jQuery('.count').html(data);
}
});
}
In functions.php I changed the $counterFile variable value to the link of …