Skip to content
Advertisement

JQuery script not firing on main page but same JQuery fires in separate php page variable inserted

I have a PHP app that works perfectly except for my hyperlinked jQuery call to another PHP page. It is a dead link but it is underlined. The jQuery code is correct, because it is the same code on a separate PHP page that I call that uses the same logic… and it works on that embedded PHP page within this challenged page. Think I’m using PHP 5.x.

const friendReqURL = 'domain.com';
const thisRandNum = Math.random();

function deny_friend(x, a, b) {
  $.post(friendReqURL, {
      request: "denyFrd",
      reqID: x,
      id1: a,
      id2: b,
      thisWipit: thisRandNum
    },
    function(data) {
      $("#request" + x).html(data).show();
    });
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<td bgcolor="#CCCCCC">
  <div align="center" class="style2">
    <span id="request' . $id2 . '">Withdraw Interest? 
	<a href="#" onclick="return false" onmousedown="javascript:deny_friend('. $requestID .','.$id1.', '.$id2.');"> Yes </a></span></div>
</td>

Page link is just inactive as if it isn’t a hyperlink (yet it is).

Advertisement

Answer

I duplicated the sql query of reqID: in my code… just found the duplication. Somehow that duplication was disabling the jquery code. Deleted it, it works now. – Vets Jun 10 2019 at 1:40 Delete

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement