How do i access variable "DataToBind" of One.cshtml page in Two.cshtml page?
One.cshtml
<script>
var DataToBind;
$.ajax({
url: "/Home/getDetails",
type: "POST",
dataType: "json",
data: JSON.stringify({ agencyID: agencyID, salesID: saleID, DebtorID: debtorID, AccountNo: accountNO }),
contentType: 'application/json; charset=utf-8',
success: function (response) {
DataToBind = response[0];
window.location.href = "Two";
}, error: function () {
console.log("new error");
}
});
</script>
Two.cshtml
I get this error : Uncaught ReferenceError: DataToBind is not defined when i use "DataToBind" variable in this page.