There is a showItems function that receives all products from the database and inserts them into the shopping page in the form of consecutive pictures with a description, there is a second function checkMyItems, which receives from the database id the goods that the user selected. Products are represented by a div element with a karinka on the background. The problem is that once the second function runs out faster than the first one, everything starts to break down visually. How to make so that we were sure that the first script was completely worked out and loaded all the pictures?
I tried it this way, but the problem remains:
$.when(showItems()).then(checkMyItems()); function showItems(){ $.ajax({ url: "shop.php", data: { Action: "getItems" }, type: 'post', success: function(data) { $.each(data.items, function(i, items) { //вставляем items ... }); }
showItemsfunction? - Stanislav Grot