Note that there are some explanatory texts on larger screens.

plurals
  1. POQuerying a function in functions.php?
    primarykey
    data
    text
    <p><em>In advance, I did ask this on the wordpress support forum but they weren't very helpful. I was hoping someone on here might be able to help me.</em></p> <p>Okay I'm a complete newbie when it comes to Wordpress plugin architecture, so bare with me. I have a jQuery code that is going to check when the user is near the bottom of the page. That's not the problem though. This jQuery is going to send a AJAX request, giving it some details on what to load when the user is near the bottom of the page. The code looks a bit like this at the moment:</p> <pre><code>$("&lt;div&gt;").load('?ajax=y&amp;offset=something', function() { $(".empty-div").append($(this)); setTimeout(function(){ console.log('after', $(document).height()); }, 0); setTimeout(function(){ console.log('after', $(window).height()); }, 0); }); </code></pre> <p>My main problem is that I don't know what to query or how to go about sending the information to the PHP function in functions.php. For example, I have at the moment this as my PHP function (until it's working):</p> <pre><code>function get_posts_page() { if(isset($_GET['offset'])) { echo"Hello!"; } } </code></pre> <p>I'm aware the wordpress has <code>add_action</code> and all that but I have no idea what I would apply as an action to either function to make the PHP recieve the data the Javascript is sending. Is there a URL where all functions are parsed or something? Thanks for any help in advance. So how do I get the data from the Javascript to the PHP function in functions.php, in my theme directory?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload