looping .load jquery setting rel
<pre><code>var resultValue = $("#"+temp+" .panId").val();
for(var i=0; i&lt;totalPanel;i++) {
    $("#"+temp+" .panelDiv").append('&lt;div class="panelDiv' + resultValue + '"&gt;&lt;/div&gt;');
    $("#"+temp+" .panelDiv" +resultValue ).load("Panel.html #w", function(){
        $(".panelDiv"+(resultValue-1)+" .txtWidth").attr('rel',resultValue-1);
        $(".panelDiv"+(resultValue-1)+" .txtHeight").attr('rel',resultValue-1);
        $(".panelDiv"+(resultValue-1)+" .btnRemovePanel").attr('rel',resultValue-1);
    });
    resultValue++;
    $("#"+temp+" .panId").val(resultValue);
}
</code></pre>

<p>Basically i trying to trigger a load function. after the load function is trigger i want to set a rel &lt;- into each so if my for loop loop 5 time rel will be 1 2 3 4 5
but now it is being set as 5 5 5 5 5 because .loop callbackfunction only execute after the loop is complete then it is being load.therefore my value resultValue is at the max of the value.
how can i solve by setting rel 1 2 3 4 5.</p>
