If I understand the question correctly, then AJAX will help you. Since there are no details, the answer will be generalized - tyts
example:
$(document).ready(function () { $('#btnSendMessage').click(function (event) { event.stopPropagation(); var data = { 'message': $('#TextBoxSender').val(), } $.ajax({ url: 'MessageHandler', type: 'POST', data: JSON.stringify(data), cache: false, dataType: 'json', processData: false, contentType: "application/json; charset=utf-8", success: function (data) { if (data == true) { alert("Сообщение доставлено"); location.reload(); } else { alert("Внимание! Сообщение не доставлено!"); } }, error: function () { alert("Произошел сбой бла бла бла"); } }); });
})
Message handling method:
[HttpPost] public JsonResult MeesageHandler(string data) { var result = "Сообщение " + data + "принято" return Json(result); }
window.location.href = "Home/Index";. The browser creates a query, the Index method of the Home controller is executed on the server using standard routing and the result is returned. - Andrew B