Link to home
Start Free TrialLog in
Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America

asked on

string to actionresult, mvc

I have a piece of information such as data from local storage in javascript. when the page is loaded, i want to send the data into below codes. Is it possible. Please show me in codes. not an experts of mvc and jquery. thanks


public ActionResult AdditionalBondInfo()
        {
string x = mydata;
}
Avatar of ITsolutionWizard
ITsolutionWizard
Flag of United States of America image

ASKER

Help?
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
How the controller picks up the data?
As a normal post - in other words however your backend framework handles posted data - you would do exactly the same.
I don't get it
My goal is to take the local storage values to action result below.

 public ActionResult AdditionalBondInfo()
        {
             return View(Method1("CA", "Plan"));
        }
I am not familiar with your server code so I cannot give you explicit instructions on how to intercept the data coming in. However, if you imagine that the data was coming in as a result of
<form action="yourscript" method="post">

Open in new window

Then this would be identical.
public ActionResult AdditionalBondInfo()
        {
             return View(Method1("CA", "Plan"));
        }

above is my server codes. how can i get the post value inside of action result?
I think I have covered this area - giving me 4 lines of code is not useful to finding a solution.

Please answer this question:
How do you get a post value from a <form> that posts to your script - do you know how to do that.

I am guessing Request.Form('data');
There is nothing to post because the values are already in local storage
I am referring to your server code.