function getContent(urlLocation, name, timeoutMs, additionalMethodCallName) { $.ajax({ url: urlLocation, type: 'GET', dataType: 'html', cache: false, timeout: timeoutMs, success: function(html){ updatePage(html, name); if (additionalMethodCallName) { if(window[additionalMethodCallName]) { window[additionalMethodCallName].call(); } } } }); } function updatePage(html, name) { var ajaxElement = $('#' + name).html(html); if (html=="") { ajaxElement.css("display","none"); } else { ajaxElement.css("display","block"); } } function clear(name) { updatePage("", name); }