Hello all, I have a strange problem with jquery load. I have this two loads on a click event:
action='first'; $( '#operators_list_div' ).html( ' ' ).load( '{% url add_save_view %}',{'action':action, }); action='second'; $( '#address_list' ).html( ' ' ).load( '{% url add_save_view %}', {'action':action,}); On first load, I add something in db(I have more arguments send). At the end I return a template that is a table and here works fine(I see what I added. In second load: Ex I add something with id = 1. I build a list(initial the list is from 1 to 255). After the id=1 was added, the list will be from 2 to 255. If i added an id=3, the list will be 1, 2, 4, 5,...255. Here I want to return another template second.html that update a drop down list with the list build. Here is the problem, sometime the list is correct, other times not. After I add id 1, the list is correctly updated(2,3...255), but sometimes is the default list(1,2...255). The strange things is that is I put an alert, between the two load, it's working fine action='first'; $( '#operators_list_div' ).html( ' ' ).load( '{% url add_save_view %}',{'action':action, }); alert('brake'); action='second'; $( '#address_list' ).html( ' ' ).load( '{% url add_save_view %}', {'action':action,}); Somebody know what I do wrong? I put some alerts, before first load, before second load, and in every template. Them are fired like this: First the alert before first load Second the alert before second load(strange, I was expected to fire the alert from the first template) Third the alert form the second template Forth the alert from the first template Why is this order?