jQuery getter/setter conditional?
<p>I have a script that needs to set one of two json data call URLs depending on which element was clicked to invoke the query. </p>

<p>How can I code the url: property so that its determined by which element was clicked?</p>

<p>Off the top of my head, I was thinking to create a hidden input field and set a flag that I can read/write to depending on the link that's clicked. Then i can wrap the url: parameter in an if/then</p>

<p>However, then I remembered that jQuery has an each() method that I might be able to use.</p>

<p>Any suggestions?</p>

<p>Code:</p>

<pre><code>&lt;div id='items'&gt;
    Label: 
    &lt;a href='#' id='item1'&gt;Item 1&lt;/a&gt;
    &lt;a href='#' id='item2'&gt;Item 2&lt;/a&gt;
&lt;/div&gt;

jQuery("#items").find("a").each.click(function(){

    jQuery.ajax({contentType: "application/json; charset=utf-8",dataType: "json",

    if(jQuery(this).id = '#item1')
    {
    url: "first url"
    }
    else
    {
    url: "second url"
    }       
});
</code></pre>
