I am developing MVC using APS.NET.
We are developing a system for POST communication using Ajax without using Form.
Since I usually develop mainly in different languages, C # is like an amateur, so I will write the process I want to do below, so I would appreciate it if you could pick it up.
Communication when using Form
- User presses a button
- POST communication is started and waits for instructions from the server
- Redirect based on instructions
I think this is normal processing, but this time I want to do this flow with Ajax.
I will describe the flow in a little more detail.
- User press Enter
- Detects Enter being pressed in JS
- If detected, POST to the specified URL with Ajax
- Check validation on server
- If the validation is correct, redirect to the specified address
- If the validation is incorrect, return the original page
* At this time, I don't want to do validation because it is troublesome for the client to check it.
I want to do something like this.Guess
Maybe you can't do what I want to do
The reason why I want to do this is that when I process it with JS, the value is checked on the browser side and the same thing is done on the server side, so the value is only on the server side like when using Form. I want to build a system that checks and processes in.
Thanks for your guidance.environment
- VisualStudio 2019
- APS.NET MVC v3.1.6
Answer # 1
>If the validation check is NG, stay on the current page and issue an error message.
>If the validation check is OK, the page will change.
>Moreover, I want to carry out the validation check on the server side.
This is the closest image of gpsoft.
It's a bit exaggerated to not wait for a response in Ajax. Sure, even if you're using a Form, the client will wait for a response from the server and redirect. What I want to do is not check the value on the client, but check the value on the server side and redirect.
If possible, I don't want to do it because it is annoying to scrutinize the response result on the client and branch the process.
If that is the case, it seems impossible.
Even if the server returns a 302 response to the Ajax request, the client does not page transition.
I think that it is impossible to transition pages with Ajax without the cooperation of the client.
- c # - i want to back up the db on the client server system
- server - 301 redirect with htaccess
- c # - how to redirect standard output for programs that require administrator privileges
- wordpress i want to redirect to another wordpress page on the same server