views:

91

answers:

1

Basically what I want the script to do, is add my affiliate ID to all Amazon links posted by my users.(Kinda what SO is doing, minus the whole redirect/racking thing)

Here is the code I'm using, and for some reason it's not working.

   <script type="text/javascript">
$(document).ready(function() {


    $('a[href*='amazon.com']').each(function() { this.href = this.href.replace(/\?.*$/,"") + $.query.load(this.href).set("tag","affID").toString();});
});
</script>
A: 

I think it might have something to do with your quotes. Try it like this:

 $('a[href*="amazon.com"]').each(function() ... etc

Notice the difference? The point is that if you use single quotes on the outside, you need to use double quotes on this inside. Or vice versa.

Greg W