由PHP编写的jQuery和超链接onclick

I have some ugly PHP code which I will clean up later, but first the code should start working OK. Now it does not execute the post command. In other words, the script find.php will not be executed. Any ideas how to fix this problem? I just would like to use one hyperlink.

<?php

  print "<div><div>Play " . $i . "<span><a href=\"#\" onclick=\"$.post('find.php', { 'my': '$my_id', 'your': '$your', 'select': '$i' } ); $('html').css({ 'overflow': 'auto', 'height': 'auto' }); this.parentNode.style.display = 'none'; return false;\">Select</a></span></div></div>
";

?>

In all honesty, you'd be better off cleaning up your code now. If you check your console, you'll more than likely get an error regarding jQuery not being loaded.

You should create a button with the required information appropriately:

<a href="#" class="mybutton" data-my-id="<?php echo $my; ?>" data-your-id="<?php echo $your; ?>" data-select="<?php echo $i; ?>">Select</a>

And create an event listener in jQuery:

jQuery(document).ready(function() {
    // handle click
    jQuery(document).on('click', 'a.mybutton', function(e) {
        e.preventDefault();
        var data = {
            my: jQuery(this).data('my-id'),
            your: jQuery(this).data('your-id'),
            select: jQuery(this).data('select'),
        }
        //post
        jQuery.post('find.php', data);
        alert(data.select);
        jQuery('html').css({ 'overflow': 'auto', 'height': 'auto' });
     this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.display = 'none'; return false;

    });
});

From there, you'll have to clean it up to suit exactly what you need. If I were you, I'd start with the correct code/path in mind instead of "looking at it later"

It seems you want to create divs dynamically with hyperlinks executing jquery post. You can achieve this entirely in javascript itself -

function postFunc(my_id, your, i) {
  $.post('find.php', {
    'my': my_id,
    'your': your,
    'select': i
  });
}

function createDynamicDiv(my_id, your, i) 
{
  var node = document.createElement('div'); //dynamically creates a div
  node.setAttribute("style", "overflow: auto; height: auto"); //set css
  newlink = document.createElement('a');
  newlink.setAttribute('class', 'dynamicDiv'); //you might want to group all divs in a common class to add common css
  newlink.setAttribute('href', 'javascript:postFunc(my_id,your,i)'); //javascript: prefix on the href makes to interpret postFunc as a javascript function
  node.appendChild(newlink);

}

Call createDynamicDiv from your code to create a dynamic div.