• Resolved speedpartner

    (@speedpartner)


    Hi,

    We’ve encountered that the AJAX-calls to the counter-scripts didn’t work out as expected. When running the plugin using a Firefox-client in the webserver-logs we got something like:

    /wp-content/plugins/top-10/top-10-addcount.js.php?top_ten_id=13422&

    which misses GET-parameters activate_counter and top10_rnd.

    Looking into the HTML-source it seems that for some reason the ampersands (&) in the JavaScript got replaced by something like & (if I remember correctly). Turning the AJAX-calls in the source to & made it work for Firefox, but it didn’t seem to work in Opera then. After call, what was needed would be simple and plain ampersands.

    To workaround this problem (wherever that escaping may have come from) we modified the JavaScript in wp-content/plugins/top-10/top-10.php in tptn_add_viewed_count() to a different calling-syntax for the jquery-AJAX-calls, passing in an array for the get-parameters:

    jQuery.ajax({url: “‘ .$tptn_url. ‘/top-10-addcount.js.php”, data: {top_ten_id: ‘ .$id. ‘, activate_counter: ‘ . $activate_counter . ‘, top10_rnd: (new Date()).getTime() + “-” + Math.floor(Math.random()*100000)}});

    Did others encounter the same problem? How do you think about this solution? That seems to have fixed it for us now.

    https://www.ads-software.com/extend/plugins/top-10/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ajay

    (@ajay)

    Does this fix it for you universally across all browsers. Most users have reported problems with the counts not getting recorded.

    Thread Starter speedpartner

    (@speedpartner)

    Seems to work for us with the browsers we tested so far, yes (Firefox, Opera, …) and logs are back to normal.
    jQuery offers both alternatives – either giving a string with ampersands or giving the parameters separately as a JS-array.

    Plugin Author Ajay

    (@ajay)

    Thanks. Let me test this on my installs

    Hello speedpartner, your solution doesn’t work for my site.
    Note that, I use AIOSEOP. I had cleaned all caches to make sure the new codes is running.. Please check my site. I’ll keep this change for 6 hours ahead.

    Thread Starter speedpartner

    (@speedpartner)

    I think/hope I was still on time now to check it out.
    It didn’t perform *any* XHR for me. Actually it even failed loading a JS-file (some minify-thing) with a 500 Internal Server Error. I guess that might be relatd?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘top 10 v1.9.6: Correcting calls to counter-script’ is closed to new replies.