jQuery AJAX Responses in ASP.NET MVC

前端 未结 4 788
借酒劲吻你
借酒劲吻你 2021-01-03 03:43

Not even sure if this is the right way to title the question. I know I\'m making my AJAX calls all wrong... here\'s what I\'m doing right now (I\'m using ASP.NET MVC backend

4条回答
  •  悲&欢浪女
    2021-01-03 04:26

    I'm not sure whether I fully understood what you mean. But your example of a validation message on an error, wouldn't that work like the following:

    1. User clicks on some button/link whatever which causes an action
    2. An asynchronouse post is done back to the server, transmitting the user id (you should be aware of security here)
    3. On the server the necessary validation is done and a response send back (in XML, Json, directly the message encoded as HTML)
    4. Back on the client side you get your response in your JavaScript code and place it appropriately on the page

    Hope that helps.

提交回复
热议问题