Hi I'm exucuting the following code and I kept the following code in separate js file and referencing that file in all other .aspx files. When I put following code in .aspx file script section directly it's working properly but when I kept it in separate js file along with other functions it's not working properly
function pageLoad(sender, args) {
var dict = $.parseJSON('<%=DictJson %>');
var data = eval(dict);
}
I'm getting error at var dict = $.parseJSON('<%=DictJson %>');. The error being displayed is Microsoft JScript runtime error: Exception thrown and not caught and it is displaying that throw in json file } if (!v("json-parse")) { var M = String.fromCharCode, N = { 92: "\", 34: '"', 47: "/", 98: "\u0008", 116: "\t", 110: "\n", 102: "\u000c", 114: "\r" }, b, A, j = function () { b = A = w; throw SyntaxError(); }, q = function () { for (var a = A, f = a.length, c, d, h, k, e; b < f; ) { e = a.charCodeAt(b); switch (e) { case 9: case 10: case 13: case 32: b++;
I wrote the DictJson is a parsed dictionary I'm parsing it in back end in some other base page where it can be accessed by each and every page. The parsing code is
public string DictJson
{
get
{
MouseOverFieldDict mdict = (MouseOverFieldDict)(HttpContext.Current.Session["MouseOverFieldDict"]);
JavaScriptSerializer jSer = new JavaScriptSerializer();
return jSer.Serialize(mdict.FieldDict);
}
}
Please help me with the error. I don't get it why it is throwing that error in script