top 10 v1.9.6: Correcting calls to counter-script
-
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.
- The topic ‘top 10 v1.9.6: Correcting calls to counter-script’ is closed to new replies.