Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can change the code to work this way:</p> <pre><code>&lt;script&gt; $(function() { $(".wpsc_buy_button").click(function(evt) { $.get("index.php", function(){ var current = parseInt($.trim($(".counter").text())); $(".counter").text(current+1); }); evt.preventDefault(); }) }) &lt;/script&gt; </code></pre> <p><strong>UPDATED</strong></p> <p>You're doing it the hard way. Here is the way you should do it: Locate the file <a href="http://tobyclothing.com/wp-content/plugins/wp-e-commerce/wpsc-core/js/wp-e-commerce.js?ver=3.8.7.6.2.494864" rel="nofollow">http://tobyclothing.com/wp-content/plugins/wp-e-commerce/wpsc-core/js/wp-e-commerce.js?ver=3.8.7.6.2.494864</a> and find these lines: (line 248 - 257)</p> <pre><code> jQuery.post( 'index.php?ajax=true', form_values, function(returned_data) { eval(returned_data); jQuery('div.wpsc_loading_animation').css('visibility', 'hidden'); if(jQuery('#fancy_notification') != null) { jQuery('#loading_animation').css("display", 'none'); //jQuery('#fancy_notificationimage').css("display", 'none'); } // add your NEW_CODE here }); </code></pre> <p>your NEW_CODE will be:</p> <pre><code> var current = parseInt($.trim($(".counter").text())); $(".counter").text(current+1); </code></pre> <p>which will then result in: </p> <pre><code> jQuery.post( 'index.php?ajax=true', form_values, function(returned_data) { eval(returned_data); jQuery('div.wpsc_loading_animation').css('visibility', 'hidden'); if(jQuery('#fancy_notification') != null) { jQuery('#loading_animation').css("display", 'none'); //jQuery('#fancy_notificationimage').css("display", 'none'); } var current = parseInt($.trim($(".counter").text())); $(".counter").text(current+1); }); </code></pre> <p><strong>UPDATE 2</strong></p> <p>If the user enters any number of quatity</p> <pre><code>var qty = parseInt(jQuery("input[name='wpsc_quantity_update']").val()); jQuery.post( 'index.php?ajax=true', form_values, function(returned_data) { eval(returned_data); jQuery('div.wpsc_loading_animation').css('visibility', 'hidden'); if(jQuery('#fancy_notification') != null) { jQuery('#loading_animation').css("display", 'none'); //jQuery('#fancy_notificationimage').css("display", 'none'); } var current = parseInt(jQuery.trim(jQuery(".counter").text())); jQuery(".counter").text(current+qty); }); </code></pre>
    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