My AJAX API plugin isn’t working

There is no PHP function alert, that’s why your function throws an error and doesn’t proceed with the rest of your code. You have to return something from the LogHit_callback function using return (or echo it with echo) and then alert it with JavaScript, that is add following code to your post function: jQuery.post( ‘http://www.test.com/wp-admin/admin-ajax.php’, … Read more

Posting to loop.php file

If that is the sum total of your loop.php, and you are accessing it directly which you are, your biggest problem is that you aren’t going to have access to any WordPress functions and yet you are trying to use WordPress functions. You are going to get fatal errors. Your script does nothing to boot … Read more

where does my function output from load-* go?

Ok, I’ve solved my problem, though my question (why I need to put die() at the end of my load-* function to let it show) remains unanswered. I couldn’t find any way to use tb_show and at the same time send super global post variables to the destination url. tb_show simply calls a url and … Read more

Ajax object comes back empty

This stackoverflow answer has a good example of basic ajax posting. https://stackoverflow.com/questions/5004233/jquery-ajax-post-example I would try adjusting your code so that the info you want to post is in the data parameter. jQuery isn’t my strongest suit, but I was under the impression that the $_POST data came through that parameter. $(‘.walkthrough-list’).find(‘a’).each(function() { $(this).click(function() { data=”p=”+p_name+&uid=’+user_meta.current_user_id+’&tut_name=”+clicked_post; … Read more

Leverage permalinks with AJAX

You can do that with html5 history API with which you can change the URL at the address bar whenever you want. Works on anything modern which is not IE, but maybe this utility will help with IE.

Memberpress isn’t cooperating with WooCommerce

Just solved this. Under memberpress options, we had to uncheck the option to “Keep members out of the WordPress Dashboard”. That was it! I think the woocommerce checkout page was using ajax to call “admin-ajax.php”. Memberpress was preventing users from accessing this page so it brought up the login redirect page instead. We’ll keep users … Read more

best way to communicate between php and jquery/javascript

At first, you’ll have to make a dropdown filled with your values from the database: <select id=”pakket”> <?php foreach ($allPakkets as $pakket) { echo ‘<option value=”‘.$pakket[‘id’].'”>’.$pakket[‘name’].'</option>’; } ?> </select> And a div to put results in: <div id=”results”></div> Now, we add a piece of javascript: jQuery(‘#pakket’).change(function(){ // when the dropdown changes… var newvalue = jQuery(‘#pakket’).val(); … Read more

update_user_meta updates to a wrong ID

That’s likely because you are using $current_user->ID, which always refers to the currently logged in user, or when “empty” object if not logged in (ID == 0). If you would like to update user meta on any other user you would have to supply the user ID of that user in the $_POST data as … Read more