After adding multiple data entries to the master table, you must add them to the subtable based on the primary key ID of each primary table. Therefore, when you think of post submission, it is ineffective to find the cyclic post, no async parameter ..
Therefore, async in ajax sets false, and loop addition does not work ..
First writing
For (int a = 0; a <10; a ++)
{
$. Ajax ({
Url: "url ",
DataType: 'json ',
Async: false
});
}
It is found that the first data has not been executed, and the subsequent data is executed again. async does not work ..
Later, I checked the data on the Internet and wrote the final statement.
For (int a = 0; a <10; a ++)
{
Add ();
}
Function add ()
{$. Ajax ({url: "url", dataType: 'json', async: false });}
In this way, the final result is achieved. Is it because every function method produces new objects? The specific reason is unclear .. Please tell me .. There is no better solution to adding data in a similar loop