I’m looking to call the following method on my page load:
I’m not sure how to because its not a hardcoded named function like say ‘function search()’
I realise there must be a easy way to do/reference this function using jQueryon my page
Many thanks for reading
$(function() {
$('#searchButton').click(function() {
var url = $('#AbsolutePath').val() + 'AuditLog.mvc/IndexSearch';
var iPage = (parseInt($('#txtPage').val())).toString();
var data = {
StartDate: $('#StartDate').val(),
EndDate: $('#EndDate').val(),
sUser: $('#SearchTextBoxUser').val()
};
$('#txtPage').val(iPage);
$("#ResultsList").load(url, data, function() {
$('#LoadingGif').empty(); $("#paging").hide(); $("#paging").show();
});
LoadCharts();
$('#LoadingGif').empty().html('<img src="' + $("#AbsolutePath").val() + 'Content/images/ajax-loader.gif" alt="Loading image" />');
});
});
Your code is only executed on the
clickevent … if you want to execute on page load and theclickevent do this :This seperates the code – I have created a new function
processClickEventthen triggered its execution on theclickevent of#searchButtonand also executed it on load