开发者

Frameworks/plugins useful for an ajax-based single-page-app with an ASP.NET MVC 3 backend

We're making a single-page app, where actions in the UI (e.g. clicking a node in a tree) will update parts of the UI by retrieving data with ajax-calls.

Does anyone have any tips or recommendations for javascript frameworks that will make the following easier:

  • Updating the URL to show what you're looking at (e.g. http://example.com/#user/edit/321)
  • Parsing an URL like that to bring up the same page from a bookmark or link.
  • Updating parts of the UI based on actions in a different part. I'm thinking some sort of event model where actions can publish an event (eg "navigation_changed" with a payload {"type":"user", "action":"edit", "id":"321"}) and other parts of the UI can pick this up to update bread-crumbs, highlight navigation and load content.
  • A good way to "ajaxify" a web-form that works with ASP.NET M开发者_如何学PythonVC3. We'd like to take as much advantage as possible of the features in MVC3 like modelbinders, validation, razor views, etc.


I would totally use http://documentcloud.github.com/backbone/ backbone.js for that

Edit: Examples >> https://github.com/ServiceStack/ServiceStack.Examples/downloads


I used the history.js library (https://github.com/browserstate/history.js) to ajaxify my page, though I'm still trying to figure out the best way to implement my controllers, and how to build up my partial views.

E.g. When user clicks an href with "~/Home/Index/", it gets rewritten to "/Home/Index" page and an ajax request is done to the Home controller and Index method so I can return a partial view and all is fine... but, when you press F5 in browser it actually goes through the ASP.NET MVC routing engine, and also returns the partial view, which breaks the page...?!


Try to look at jquery-bbq plugin.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜