Answer the question
In order to leave comments, you need to log in
Use JS Ajax or use the Ajax helpers built into Razor?
Good afternoon!
I have a task to make a profile form with several tabs, in which you can edit profile data, settings and password separately. Each tab has its own Save button.
If the data is changed incorrectly, a message should appear on the corresponding panel stating that the data is incorrect.
Previously, I planned to do this through the usual asp mvc + razor, where from one view 3 controller methods can be accessed. How to implement display of messages about incorrectly filled model on a page with several tabs?
But now I realized that this is not the way to solve my problem.
I thought that if you do everything through Ajax. JavaScript sends an Ajax request, and if the model is filled incorrectly, then it receives Json with error data, if it is correct, then everything is ok. And I saw that Razor has @Html.Ajax ajax helpers.
Now I’m thinking whether it’s worth using or it’s easier to write in JavaScript right away (I have moved away from using helpers like @Html.LabelFor @Html.EditorFor and now I’m thinking whether it’s worth dealing with Ajax helpers.
Has anyone tried Ajax helpers and should they be used?
Answer the question
In order to leave comments, you need to log in
ajax helpers are very limited in their capabilities (like any other helpers in fact). they are applicable in the simplest cases like: send, receive, withdraw. if you receive data from the server in the form of json, then you still have to write js functions to process the response. so in your case it's better to think about ajax request via js.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question