$(document).ready() is not working after coming back from a page

$(document).ready() is not working after coming back from a page

Dear All,

I am developing an application in asp.net using c#. In my page I have done ajax call to load the page with html. The html code is coming from the database. This ajax call is written in the document.ready() function. When I am first time loading the page its working fine. When I am going to another page, that is also working fine. But when I am trying to coming back from that page then the document.ready() is not working. For that reason the html code is also not getting populated. How can I solve this issue please help me out from here.

Document.ready() code is as follows:

$(document).ready(function () {
    // Dynamic Template Load Code - Added by Shubhadeep [START]
    tempName = GetParameterValues("templateName");
    //alert(tempName);
    if (tempName != "" || tempName != null) {
        $.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            url: "DesignCenter_Static.aspx/loadTemplatePackage",
            data: "{'template_name':'" + tempName.toString() + "'}",
            dataType: "JSON",
            success: function (data) {
                var temp_data = data.d.toString();
                var temp_arr = new Array();
                temp_arr = temp_data.split("|");

                $("#divTemplateLayout").html(temp_arr[0].toString());
                $("#inputForm").html(temp_arr[1].toString());
                $("#divButtonSet").html(temp_arr[2].toString());

                // Set drag and resize -- Surojit Added [START]
                $("#inputForm").find('[id^="txt"]').each(function () {
                    var cName, labelControlName, divControlName, resizeClassName, existingClassName, txtName;
                    txtName = $(this).attr("id");
                    cName = txtName.slice(3, txtName.length);
                    divControlName = "lbl" + cName;

                    $("#" + divControlName + "").resizable({
                        maxWidth: 300,
                        minHeight: 16,
                        minWidth: 50,
                        containment: "parent",// Added by Surojit Chowdhury
                        autoHide: true,
                        handles: "n, e, s, w, ne, se, sw, nw"
                    });
                    $("#" + divControlName + "").draggable({ cursor: 'move', containment: ".setLimit" });
                });
                // Set drag and resize -- Surojit Added [END]
            },
            error: function (result) {
                alert("Error");
            }
        });
    }
    
    $("#ddlZoom").val("100%");
    currentZoomLevel = $("#ddlZoom").val();
    fillInitialDesignStudio();
});

Back Button Code of another page is as follows:

$(function () {
            $("#btnBack").click(function () {
                var resPage = GetParameterValues("responsePage");
                var tempName = GetParameterValues("templateName");
                window.location.href = resPage + "?returnPage=BC_Proof.aspx&templateName=" + tempName;
            });
        });


GetParameterValues Code:

function GetParameterValues(param) {
    var url = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    //alert(url);
    for (var i = 0; i < url.length; i++) {
        var urlparam = url[i].split('=');
        if (urlparam[0] == param) {
            return urlparam[1];
        }
    }
}