I have a custom preference center built in CloudPages. Also have a separate code resource file (RetrieveMemberdata.js) which contains all my AMPScript. This file is invoked from CloudPage using tag as below. Below is the snippet from my CloudPage -
</style>
%%[Set @subkey = _subscriberkey]%%
<script type="text/javascript" src="http://cloud.homes.xyz.email/RetrieveMemberdata.js"></script>
</head>
<body class="typical ">
Now in the JS file (RetrieveMemberdata.js), I want to be able to access the value of this subscriberkey. Once I am able to obtain it, there is a lot of logic that will be executed using AMPScript in this file. I tried using the below but it doesn't work
var RetrievedInfo = {};
var RetrievedContactInfo = {};
var subskey= Variable.GetValue("@subkey");
%%[
VAR @email, @count, @IsValid, @IsContact
....
....
]%%
Help will be much appreciated