Note that there are some explanatory texts on larger screens.

plurals
  1. PORefresh multiple div-[unique_ID]'s with jQuery and .load()?
    primarykey
    data
    text
    <p>I am working on modifying a plugin to allow users to vote on posts. My page looks something like this (though this is simplified of course):</p> <pre><code>&lt;div class="vote vote1"&gt; //voting buttons &lt;/div&gt; &lt;div class="vote vote2"&gt; //voting buttons &lt;/div&gt; &lt;div class="vote vote3"&gt; //voting buttons &lt;/div&gt; &lt;div class="vote vote4"&gt; //voting buttons &lt;/div&gt; </code></pre> <p>As you can see, each voting div has a unique class associated with it, vote[id]. My trouble is that after submitting the vote to my vote.php file I need to refresh this unique voting div with the new data. I have been able to do this without trouble when I hardcode a particular voting div's unique id into .load(), but I cannot seem to get this to work dynamically for <strong>all voting divs</strong> using a single script. Would somebody be able to help me out in refreshing the unique voting div that has been clicked? </p> <pre><code>&lt;script type="text/javascript"&gt; jQuery(document).ready(function(){ $(".vote a.can-vote").click( function() { var some = jQuery(this).parent(); var thepost = jQuery(this).attr("post"); var theuser = jQuery(this).attr("user"); var updown = jQuery(this).attr("up-down"); var is_update = jQuery(this).attr("update"); var votebox = ".vote"+thepost+" span"; jQuery.ajax({ type: "POST", url: "&lt;?php bloginfo('template_url'); ?&gt;/vote.php", data: {user: theuser, post: thepost, up_down: updown, update: is_update}, cache: false, success: function( data ){ jQuery(some).load('http://mydomain.com div.vote[ID]'); } }); return false; }); }); &lt;/script&gt; </code></pre> <p>I'm sorry if this is a simple question but I've been trying my best to figure it out for two days with no luck; thank you in advance for any help.</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.
 

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