javascript - MVC Jquery/Controller Post Redirect -
I am struggling to get the following, I have a page where a user logs a call , The user has to select them from the input field and several dropdowns, then I must post that data on either side (either via JQuery or the controller), where the user can view the entered data and do it Whether or not the decision can take.
I have been back for ages now and I have been trying to find out how to post data from my controller with my CSTMT and then redirect it to the second page with that data. .
I have tried to redirect it through JQuery and / or the controller and just can not seem to do one or the other.
Code extract below:
cshtml:
$ .ajax ($ url: dir + '/ Submit /', async: true, Type: 'post', data: JSON.stringify (callData), contentType: 'application / json; charset = utf-8', complete: function () {}, success: f action {}} < / Code>
Controller:
[HTTP post] Submit Public Action Report (SupportCollModel CallData) {HelpModelModelNew Data = New Support CallModel (); NewData.SupportCallID = 1; NewData.CallTypeID = callData.CallTypeID; New data Troubleshooting = CallData Troubleshooting; NewData.EmailRequest = callData.EmailRequest; NewData.MailDate = callData.MailDate; NewData.FSEOnSite = callData.FSEOnSite; NewData.FSEEmployeeID = CallData. FSEEmployeeID; NewData.CallCategory = callData.CallCategory; NewData.CallType = callData.CallType; NewData.CallItem = callData.CallItem; New data Table = calldata NewData.Description = callData.Description; NewData.ExternalReference = CallData.XAARAFrence; NewData.CallStatusID = CallData. CallStatusID; NewData.CallPriorityID = callData.CallPriorityID; NewData.CallCoEmployeeID = CallData. CallCoEmployeeID; Return Redirect Action ("Verify", New Data); } Verify Public Functionality (Support CallModal PostData) {Return View (PostData); Using Ajax is nonsensical because the AJAX call remains on the same page ( Redirect return action ("Verify", New Data);
has been ignored) . You can submit a general. Keeping your rendering in mind, with all necessary inputs of Support CallModel
, then it will be posted back. I would recommend to include you [HTTP post] Submit Public Action Report (Support Callmodel CallData) {if (! ModelState.IsValid) {Return View (Call Data); } ...
Validation in the model is located at the top of the status of errors.
Then you can create a new example of If I'm not sure that < Code> Verify SupportCallModel
which is useless on the basis of call data (why just
newData
instead of callData is not passed?)
GET method is rendering, but if it contains all the properties Control is not included, then the SupportCallModel
has the properties of the value only, then you Return RedirectToAction ("Verify", newData);
or return can use RedirectToAction ("Verify", call data). ;
. Intrinsically, a rootwholection
is created based on the name and value of each property and will be bound in the PostData correct
Verify ()
method. If any property is a complex type or archive, then binding will fail for those properties. In that case you need to continue the model so that it can be recovered in the Verify
method. My recommendation will continue for the database (either a separate table or an existing table that indicates a pending status), but you must continue to session
or TempData (In Conjuction with
Pike
, if the user hits the refresh button, then it can not be lost.) verify
submit button will have to post back some ID values that allows you to retrieve the model from the database or session again and save it in the database. .
Comments
Post a Comment