Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Have you considered moving this out into a javascript file? I don't see any point in generating this with PHP since there are no PHP variables being used. Also, it seems as if your HTML may look something like this.</p> <pre><code>&lt;html&gt; &lt;img id="1" class="agree1" src"" /&gt; &lt;img id="1" class="notagree1" src"" /&gt; &lt;/html&gt; </code></pre> <p>If that is the case you really shouldn't have different elements with the same ID. I think something like this.</p> <pre><code>&lt;html&gt; &lt;img id="agree1" class="agree" src"" /&gt; &lt;img id="notagree1" class="notagree" src"" /&gt; &lt;/html&gt; </code></pre> <p>The corresponding JS would be:</p> <pre><code>$("img.agree").click(function() { var follow_id = /\d/.exec(this.id); //parse out the number you are looking for with a regex var user_id = $("img.user_id").attr("id"); $.ajax({ type: "POST", url: "/sys/follow.php", data: { 'follow_id': + follow_id, 'user_id': + user_id }, success: function(html){} }); $("#agree"+follow_id).hide(); $("#notagree"+follow_id).css('display','inline-block'); }); $("img.notagree").click(function() { var follow_id = /\d/.exec(this.id); //parse out the number you are looking for with a regex var user_id = $("img.user_id").attr("id"); $.ajax({ type: "POST", url: "/sys/dontfollow.php", data: { 'follow_id': + follow_id, 'user_id': + user_id }, success: function(html){} }); $("#notagree"+follow_id).hide(); $("#agree"+follow_id).css('display','inline-block'); }); </code></pre> <p>And again, I advocate removing this from the PHP as well</p>
    singulars
    1. This table or related slice is empty.
    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.
    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