I am facing a very strange issue. I have been trying to debug this.
Below is my small jQuery load function which loads the html into a divId based on the values in a hashmap at the time of iteration:
$.each(hashMapJSON, function(k, v) {
$('#'+k).load(v);
});
hashMapJSON is a JSON of a hashMap<String, String> in which:
key --> divId and
value --> URL
When I have multiple k-v pairs in my hashMap, only one of them is loaded with this function. However, if I add a small alert between the HashMap iteration, it works perfectly fine. Something like this works.
$.each($hashMapJSON, function(k, v) {
alert("key: " + k + ", value :: " + v);
$('#'+k).load(v);
});
How can I make my first set of code work without an alert in between successive calls?