Im trying to improve performace on a page by setting link on hyperlink by javascript to improve performance. I was looking for the right forum and i ended up here.
<form id="form1" runat="server">
<asp:HiddenField ID="HiddenFieldLocation" runat="server" />
<script type="text/javascript">
$(document).ready(function () {
//$(window).load(function () {
//$("#HiddenFieldLocation").trigger('change');
$("#HiddenFieldLocation").load("Location.aspx");
$("#HiddenFieldLocation").change(function () {
//$("#HiddenFieldLocation").load("Location.aspx").change(function () {
$("#ShowOnMap").attr("href", $("#HiddenFieldLocation").html());
});
//});
$("#HiddenFieldLocation").load("Location.aspx");
});
</script>
i tryed with this code:
if i use document ready event the href is not set because the script is executed before the hiddenfield is set with the url.
if i use window load event same thing happens. So the last thing i tryed was setting change event on hidden fields value this event gets never triggered, maybe because im using .load(). So im out of ideas.
If you still dont understand my problem i will shorten. To load the page takes 2 seconds. To generate the link takes maybe 5sec. So the idea is to set the url on the hyperlink when the value is set in the hiddenfield. This will improve the load time but
the link would be set when it is generated from the server side.
Thank you in advance...:)