Hi Saira,
I can give one suggetion.. But I don,t know whether it works for your condition.. :-)
Try to give ajax setup as synchronous..
Or else try to do parent.somefunction() from main.html to call functions in index1,index2.html to return values.. Might be it useful..
Regards,
Surendra.