jQuery Ajax - Alternate XML sources for each request
<p>I have two XML sources to retrieve data from. I want to use them alternately per page load. So when someone visits the page the first source will be used, next time the visit the page the other source will be used. Here is the ajax request I am using to get one data source:</p>

<pre><code> $(document).ready(function() {
            $.ajax({
                type: "GET",
                url: "source1.xml", //how do I alternately load two different xml data sources?
                dataType: "xml",
                success: function(xml) {
                    var counter = 0
                    var output = '&lt;li&gt;';
                    $(xml).find('person').each(function(){
                        counter++;
                        var image = $(this).find('image').text();
                        var name = $(this).find('name').text();
                        var title = $(this).find('title').text();
                        var company = $(this).find('company').text();

                        output = output + '&lt;div&gt;&lt;a href="#"&gt;&lt;img src=img/' + image + '.jpg /&gt;' + '&lt;br /&gt;&lt;label&gt;&lt;span&gt;' + name + '&lt;/span&gt;&lt;br /&gt;' + title + '&lt;br /&gt;' + company + '&lt;/label&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;';
                        if(counter % 3 === 0){
                            output = output + '&lt;/li&gt;&lt;li&gt;';
                        }
                    });
                    output = output + '&lt;/li&gt;';
                    $('#update-target ul').html(output);
                }
            });
        });
</code></pre>

<p>For extra info, here is how I am alternately loading 2 flash files using PHP:</p>

<pre><code>if(isset($_SESSION['rotation'])){
$picker = $_SESSION['rotation'];
}else{
$picker = rand(0,1);
}

if($picker == 0){
echo '&lt;script type="text/javascript"&gt;
    var video1 = new SWFObject("somefile1.swf", "p1", "151", "590", "9", "#ffffff");
    video1.addParam("wmode","transparent");
    video1.write("meh");
&lt;/script&gt;';

$_SESSION['rotation'] = ++$picker;
} else {
echo '&lt;script type="text/javascript"&gt;
    var video1 = new SWFObject("somefile2.swf", "p1", "151", "590", "9", "#ffffff");
    video1.addParam("wmode","transparent");
    video1.write("meh");
&lt;/script&gt;';

$_SESSION['rotation'] = --$picker;
}
</code></pre>

<p>I realize I could just stick the jquery document ready code right in there where I have the js calling the flash but it does not seem like a very efficient way of handling this. What is a "best case" way to do this?</p>
