Order of ajax requests is always different
<p>I have a javascript code which have to request the database (ajax). But I discovered that the inserts were wrong but with the right sql request. So I added an alert on which ajax request to know when the code is executed. </p>

<p>Here is the code :</p>

<pre><code>$.post("/kohana-v3.3.5/ajax/update_simulation", {
                    id_simulation: id_simulation,
                    nom_simulation: nom_simulation,
                    sol_simulation: sol_simulation,
                    station_simulation: station_simulation,
                    iteration_simulation: iteration_simulation,
                    scenario_simulation: scenario_simulation
                }
                , function (result) {
                    console.log(result);
                    alert('update');
                });

$.post("/kohana-v3.3.5/ajax/delete_pousses", {id_simulation: id_simulation}, function (result) {
                console.log(result);
                alert('delete');
            });

$(this).prev('div').find('table .formRows').each(function (i) {
                            alert('here');
                            if (cpt % 2 == 1) {
                                //interculture
                                var $tds = $(this).find('td option:selected'),
                                    culture = $tds.eq(0).val(),
                                    date = $tds.eq(1).text();
                                itk = null;
                            } else {
                                //culture
                                var $tds = $(this).find('td option:selected'),
                                    culture = $tds.eq(0).val(),
                                    itk = $tds.eq(1).val();
                                date = null;
                            }

                            $.post("/kohana-v3.3.5/ajax/insert_pousses", {
                                id_simulation: id_simulation,
                                culture: culture,
                                date: date,
                                itk: itk,
                                rang: cpt
                            }, function (result) {
                                console.log(result);
                                alert('insert');
                            }); //Fin du post

                            cpt++;


                        }); //Fin du each
</code></pre>

<p>Each time I run that code, the order of the alert is always different ! Sometimes "insert update delete", sometimes "update, delete insert" ...</p>

<p>And it's a problem because if the delete is the last one, the insert will be removed. So, is it a normal way ? How should I resolve it ?</p>