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

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.