[Solved] Send Javascript Vairable To C# MVC controller [closed]


If I understand what you’re trying to do here is to call an endpoint with plain javascript?

This will do the job for you:

function callYourController(id, propertyName, value) {
   var xhttp = new XMLHttpRequest();
   xhttp.onreadystatechange = function() {
       if (this.readyState == 4 && this.status == 200) {
           console.log(this.responseText);
       }
   };
   xhttp.open("POST", "www.google.com?id=" + id + "&propertyName=" + propertyName + "&value=" + value, true);
   xhttp.send();
}

6

solved Send Javascript Vairable To C# MVC controller [closed]