$(document).ready(function () { var value = getParmsVals()[\"search\"]; $.getJSON(\'/api/search/GetQuestionByKey/\' + value, function (jsonData) { $(
I like the answer by @tymeJV it is an easy solve to the problem
I just wanted to point out that solving the big picture of having easily accessible data inside Javascript is a great reason why data-centric JS frameworks exist
http://knockoutjs.com/ http://backbonejs.org/ http://angularjs.org/