Unable to pass data to action

function addComment() { var request = new XMLHttpRequest(); request.open('POST', "/Picture/AddComment", true); request.onreadystatechange = function(e) { if(this.readyState == 4) { if (this.status == 200) { alert(request.responseText); } } } request.send("comment=qwe"); } 

comment = null here

 public IActionResult AddComment(string comment) { return View("Index"); } 
  • How is addComment called on the client? - Igor
  • <input type = "button" onclick = "addComment ();" value = "Add comment" /> - Viktor Bylbas

0