Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [HttpPost]
- public ActionResult Test(dataType data) //тип данных опредяйте сами в зависимости от задачи
- {
- ... //Какое-то действие с вашими данными
- return Result;
- }
- function sendDataToController()
- {
- let data = localStorage['someData']; //данные, которые надо передать на сервер из localStorage
- let xhr = new XMLHttpRequest();
- let body = 'data=' + encodeURIComponent(data);
- xhr.open("POST", '/submit', true);
- xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- xhr.send(body);
- ... // какая-то обработка данных
- }
Add Comment
Please, Sign In to add comment