I have these functions. My objective is separate the load function to the rest of the script because i want to customize the loading message
function loadContent(url) { $('body').html('Loading'); content = load(url); $('body').html(content); } function load(url) { var result = null; var scriptUrl = url; $.ajax({ url: scriptUrl, type: 'get', dataType: 'html', async: false, success: function(data) { result = data; } }); return result; } Now, I call the loadContent function:
$(document).ready(function(e) { loadContent('index.php'); }); The problem is in this line:
content = load(url); because the function load() override the loading message.
How can I solve this? Thanks guys!