0

how can I use pure javascript rather than jquery or any external library to call a controller in MVC

controller

public class SomeController : Controller
{
    public ActionResult SomeMethod(string key, string value)
    {
      return this.Json(new { success = true });
    }
}

JQuery

$(function () {
    $.post('/SomeController /SomeMethod', 
           { key : "TestKey", value : 'Test' }, function (data) 
    {
        alert("Success " + data.success);
    });
});

what is the equivalent syntax of above jquery in javascript

tereško
  • 56,151
  • 24
  • 92
  • 147
user862226
  • 129
  • 2
  • 7

0 Answers0