I currently have a button that, when clicked, takes input values and redirects to another page in JavaScript using the following code
window.location = "Action Param1=value1&Param2=Value2"
. However, I am looking to avoid using query strings for this method.
I have decided to explore using ajax instead:
` $.ajax({
type: "POST",
url: "/MyController/MyAction",
data: '{Param1:"value1",Param2:"value2"}',
contentType: "application/json,charset=utf-8",
dataType: "json",
success: function () {
}
});`
Although this successfully calls the controller, it does not return anything. If anyone can provide a working solution or point out any mistakes I may have made, I would greatly appreciate it.