Maybe this is silly but I was wondering if it is possible to run any scripts, specifically Ajax, within the Controller of .Net MVC.
i.e. Can I wrap this in anything to make it compile and work when this method is called?
[HttpPost]
public ActionResult apiLookUp()
{
$.ajax({
url: 'example.com/api',
type: 'GET',
dataType: 'json',
data: {
},
success: function (json) {
},
error: function (errorThrown) {
}
});
return Json(new { Success = json });
}