开发者

Ajax #anchors processing with MVC

开发者 https://www.devze.com 2023-01-08 21:33 出处:网络
I am looking to standardize the processing of ajax #anchors at the server side, using MVC. Before a controller action is invoked I want to convert every request with ajax anchors into a 开发者_StackO

I am looking to standardize the processing of ajax #anchors at the server side, using MVC.

Before a controller action is invoked I want to convert every request with ajax anchors into a 开发者_StackOverflowrequest without ajax anchors, so that the controller code does not know there were anchors in the request:

For example:

1) /user/profile#user/photos should be treated as /user/photos

2) /main/index#user/profile/33 should be treated as /user/profile/33

What is the best technique in MVC to accomplish that?


Anchors are not pushed to the server with the url. One option would be to put the value /main/index#user/profile/33 inside a hidden field and get the contents of this from your controller.

However I am not sure how you are using the anchors within the markup page so this may not help!

0

精彩评论

暂无评论...
验证码 换一张
取 消