UPDATED
This is my structure:
FILE.json
{
"Page": [
{
"Id": 0,
"IsActive":true,
"PageName":"crosstownrunning",
"PageURL":"crosstownrunning"
}
]
}
FILE.js
$.noConflict();
jQuery(document).ready(function ($) {
// VARS
var PageTemplate;
// GET JSON
jQuery.getJSON("FILE.json", function (x) {
// alert(x.Page[0].PageName); << This works
PageTemplate = x.Page[0];
});
alert (PageTemplate.PageName);
alert (PageTemplate.PageURL);
// Can I make PageTemplate.anything bring up my JSON data outside getJSON function?
});
How can I call the x
outside the function?