0

I need to send data to a Controller to Post data currently I'm not using a form only I need to send an array for parameters, what is the right way to do it ?now I'm using this line of code but I know that it is used for Get method instead of Post method:

 window.location.href = "@Url.Action("Edit", "PurchaseOrder")?arr"+urlParams;

1 Answer 1

1

the only easy way to post data to a controller is to do it through a form. but that doesnt mean the form needs any text input or stuff like that as long as code the data in and you make it invisible for a user you can just use a button that looks like a normal button but is actually a form in de code.

else if you dont want to use a form to send the data even if the inputs on the form are not visible you could use AJAX to send a post request but i dont think you want to do that.

if you are already getting the data from a different page in my oppinion it would be easier to just use sessions to store the values when you get them for the first time

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.