0

Im trying to send data to action in controller using xhr ,when i used code bellow i got null values in data1 and data2 :

jquery code:

<script>
    alert('s')
        var data1 = "some string";
        var data2 = "other string";

        var xhr = new XMLHttpRequest();
        xhr.open("POST", "/Pages/UploadAudio", true);
        xhr.send(data1, data2);
        xhr.onreadystatechange = saved;
    </script>  

controller action:

[HttpPost]
        public  IActionResult UploadAudio(string data1,string data2)
        {
            
            //string audio = await UserFile.UploadeNewFileAsync("", recording, _environment.WebRootPath, Properties.Resources.Courses);
            return Ok();
        }

0 Answers0