I\'m new to ASP.NET/MVC3 and I\'m trying to figure out how to separate my JavaScript (which contains C#) from the rest of the HTML.
If I put them into .JS files and
We convert our C# objects to Json with an extension on object and JavaScriptSerializer:
public static string ToJson(this object item) { return new JavaScriptSerializer().Serialize(item); }
Then we send set it on a variable (or in our case pass it to the constructor of the JavaScript Controller)