I was wondering how I could pass a string that I made with javascript into a code block in razor. Given the few lines of simple js below:
var k=0;
var str1 = 'Model.FeaturedItems[';
var str2 = '].SubHeadline.ToString();';
var query = str1 + k +str2;
How would I then pass the string query into a code block? something like this:
alert("@"+query);
should print the result of that line of code.
EDIT:
Basically I want to execute this code: Model.FeaturedItems[0].SubHeadline.ToString(); and do something with the result in jquery. However I keep getting a syntax error trying the above.