I need a page called via ajax to fully reload everytime I request it. Currently, when requested for the first time it loads the page correctly, but when requested the second time it loads with the previous result and then after 2 or 3 second loads the new result.
I want it to show a loading image while it reloads the page into my div.
See code I'm using below:
$io('#load_order_preview').on('click', function(){
var portfolioName = $io("#portfolioName").val();
var instrumentType = $io("#instrumentType").val();
var securityName = $io("#securityName").val();
var orderType = $io("#orderType").val();
var priceType = $io("#priceType").val();
var quantityRequested = $io("#quantityRequested").val();
var orderTermName = $io("#orderTermName").val();
var limitPrice = $io("#limitPrice").val();
var stockPrice = $io("#stockPrice").val();
var stopPrice = $io("#stopPrice").val();
var dataString = 'portfolioName='+ portfolioName + '&instrumentType=' + instrumentType + '&securityName=' + securityName + '&orderType=' + orderType + '&priceType=' + priceType + '&quantityRequested=' + quantityRequested + '&orderTermName=' + orderTermName + '&limitPrice=' + limitPrice + '&stopPrice=' + stopPrice;
$io('#load_popup_modal_orderpreview').load(
'load-preview.php?' + dataString
}).modal({
backdrop: 'static',
keyboard: false
}).show();
});
I'd really like some help to solve this problem.
Thanks in advance.