Каков синтаксис, когда слово «Загрузка ...» исчезает до того, как данные JSON будут отображаться? Сейчас данные скрыты, и ничего не отображается.Текст FadeIn с использованием JQuery
a1.start = function(hookElementSelection, dataurlForJsonFile) {
jQuery('<div/>', {
id: 'loading',
text: 'Loading...'
}).appendTo(hookElementSelection);
hookElementSelection.hide();
$("hookElementSelection.loading").fadeIn("fast");
//resetting data in case this isnt the first run through
a1.products = {};
a1.recipes = {};
a1.suppliers = {};
a1.bakedRecipes = [];
//make an ajax call and wait for success
$.ajax({url:dataurlForJsonFile}).success(function(data) {
//get the recipe data
parseJSONData(data);
//put the recipes on the page
$.each(a1.recipes, function(i, recipe) {
recipe.render(hookElementSelection);
});
renderCalculator(hookElementSelection); //add in the final calculation logic
});
};
Похоже, что вы хотите, чтобы текст «Загрузка ...» затухал, имеет задержку, а затем заменяется данными JSON. Это верно? Добавьте функцию .delay() в вызов JSON. – jpostdesign