var RateSummaryContainers = new Array(); function loadRateSummary(targetID,year,rate,maturity) { targetIDElem = '#'+targetID; if(RateSummaryContainers[targetID] == undefined) { $(targetIDElem).html("Loading ..."); var myUrl = "https://www.emmi-benchmarks.eu/emmi//emmi/utilities/tablesummary-ajax-backend.html"; var params = {rate_code: rate, maturity_code: maturity, selectedYear: year, summaryAction: 'showDetail'}; $(targetIDElem).load(myUrl,params,function(response, status, xhr) { if (status == "error") { var msg = "Sorry but there was an error: "; alert(msg + xhr.status + " " + xhr.statusText); } else { SummaryLoadSuccessfull(targetID); } }); /*var myAjax = new Ajax(myUrl,{ method:'get', update: $(targetID), onComplete: showResponse, onFailure : function(){ alert('sorry we have an internal error, try again later'); } }); myAjax.send(pars); */ } else { if(RateSummaryContainers[targetID].visible) { $(targetIDElem).fadeOut(); //alert($(targetIDElem).display); //$(targetIDElem).style.display= "none"; RateSummaryContainers[targetID].visible = false; } else { $(targetIDElem).fadeIn(); //$(targetIDElem).style.display= "block"; RateSummaryContainers[targetID].visible = true; } } } function SummaryLoadSuccessfull(targetID){ RateSummaryContainers[targetID] = {loaded:true,visible:true}; };