I am new to .NET MVC and have been experimenting with different return types in MVC. However, I am having trouble getting the JavaScriptResult to work. In my controller, I have the following code:
public ActionResult DoSomething() {
string s = "alert('Hello world!');";
return JavaScript(s);
}
This is what's in my view:
@Ajax.ActionLink("click", "DoSomething", new AjaxOptions())
When I click the link, it simply displays "alert('Hello world!');" as a string instead of triggering the alert. Can anyone help me figure out what I'm doing wrong here?