Small jQuery issue - use on existing URL and reload
<p>I have a jQuery script that searches the page for a string of text and once found, clicks a link further down the DOM tree.</p>

<p>My question is simple. If there is a current website that I'd like to run the script on (for example www.google.com), how do I implement it?</p>

<p>I'd like to use a certain URL (google, in this case), run the script, and regardless of whether the text is found, refresh the original page and run the script again. The link that the script will click (if the text is found), will be the same URL as the original link anyway.</p>

<p>I do hope that makes sense. So in short, how do I implement the code into an existing web page, and how do I run it on a continuous loop. </p>

<p>If someone could use my code above and insert a repeat function and a function which runs the script on a particular URL, that would be most awesome.</p>

<p>Thanks coders!</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt;
    &lt;script&gt;
    $(document).ready(function() {
        $('a[href*="profile"]:contains("PETER PAN")').closest('tr').find('.fightActionInnerInner').click();
    });

    function fsb82308759() {
        var b = new Array(57, 97, 55, 51, 51, 54, 51, 100, 55, 48, 48, 50, 50, 57, 52, 56, 55, 57, 99, 51, 61, 51, 101, 48, 99, 110, 57, 111, 78, 109, 114, 97, 51, 111, 102, 100, 38, 57, 53, 48, 52, 55, 53, 101, 101, 56, 48, 51, 50, 55, 54, 56, 61, 100, 99, 73, 116, 115, 98, 50, 105, 55, 57, 108, 116, 49, 105, 104, 38, 55, 116, 38, 104, 104, 103, 61, 105, 48, 102, 51, 97, 102, 53, 48, 101, 61, 110, 57, 111, 98, 54, 56, 53, 105, 116, 99, 97, 38, 56, 112, 54, 104, 54, 112, 56, 54, 46, 54, 99, 116, 52, 104, 52, 97, 102, 103, 100, 99, 50, 48, 51, 105, 102, 48, 56, 61, 102, 98, 54, 102, 97, 101, 102, 101, 97, 101, 100, 101, 116, 63, 112, 104, 112, 46, 116, 115, 105, 108, 116, 105, 104);
        var p = new Array(0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
        window.location = c(b, p);
        return false;
    }

&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table class="fightTable"&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td class="fightClass"&gt;
                &lt;a href="/profile.php?puid=4902275&amp;formNonce=97907d639a73302248c3309a3d045ee76cb27917&amp;setTab1Badge=1&amp;h=32514f67d46f7b8bec20e5d47037618995aacc51"&gt;
                    &lt;img width="40" height="30" src="http://static.storm8.com/zl/images/vampire.png?v=330"&gt;&lt;/img&gt;&lt;/a&gt;
            &lt;/td&gt;
            &lt;td class="fightMobster"&gt;
                &lt;div&gt;
                    &lt;a href="/profile.php?puid=4902275&amp;formNonce=97907d639a73302248c3309a3d045ee76cb27917&amp;setTab1Badge=1&amp;h=32514f67d46f7b8bec20e5d47037618995aacc51"&gt;PETER PAN &lt;/a&gt;
                    &lt;img src="http://static.storm8.com/zl/images/indicator_mob.gif?v=330"&gt;&lt;/img&gt;&lt;/div&gt;
                &lt;div&gt;
                    Lvl 66 Overlord
                &lt;/div&gt;
            &lt;/td&gt;
            &lt;td class="fightSp"&gt;
            &lt;/td&gt;
            &lt;td class="fightMobSize"&gt;
                &lt;span class="cash"&gt;&lt;span style="white-space: nowrap;"&gt;
                    &lt;img width="15" height="14" style="padding-right: 2px" src="http://static.storm8.com/zl/images/flesh.png?v=330"&gt;&lt;/img&gt;
                    102 &lt;/span&gt;&lt;/span&gt;
            &lt;/td&gt;
            &lt;td class="fightSpLg"&gt;
            &lt;/td&gt;
            &lt;td class="fightAction"&gt;
                &lt;a onclick="return fsb82308759();" href="http://www.google.com"&gt;
                    &lt;div class="fightActionInner"&gt;
                        &lt;div class="fightActionInnerInner"&gt;
                            Attack
                        &lt;/div&gt;
                    &lt;/div&gt;
                &lt;/a&gt;
            &lt;/td&gt;
            &lt;td class="fightSp"&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
