building relative URLs for an MVC app with JavaScript

后端 未结 3 2010
不思量自难忘°
不思量自难忘° 2020-12-17 20:24

I\'m having trouble getting C# and JavaScript/jQuery to play nice here.

I have a knockout view model, plain old javascript object... one of its property/methods fire

3条回答
  •  执念已碎
    2020-12-17 21:08

    The way we do this in my MVC 3 project is to include the following in the Master Layout:

    
    

    Then you just prepend that to your URLs in the JavaScript.

    Which in your sample would read:

    url: baseSiteURL + 'vendors/' + viewModel.count() + '/' + viewModel.filterText()
    

提交回复
热议问题