public async Task<actionresult> Index(decimal? x, decimal? y) { ... result = JsonConvert.DeserializeObject<list<road>>(roads); return View(result); }
function CallFunction() { alert("test"); } @if (Model != null) { <text>alert("test")</text> @Html.Raw("CallFunction();"); } $.ajax({ url: "Home/Index", type: "GET", dataType: "html", data: { val1: x, val2: y}, success: function (data) { }, error: function (data) { //alert(data); } }) What I have tried: In the code above, the alerts do not work. When I replace "if (Model != null)" with "if (true)", the Javascript alerts work. I debugged and I am sure that "if (Model != null)" evaluates to true. The goal from this is to check the model properties for specific values and then alert the user. It has to be the AJAX call back to the controller (communication is continuously going on between the controller and the view) that is causing this. Any help is appreciated.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)