使用.js文件的MVC棘手问题

时间:2012-05-27 12:00:07

标签: javascript jquery asp.net-mvc

在MVC中有2个视图说:

  View-A contains A.js which further contains function A()

  View-B contains B.js which further contains function B()

现在我想从function A()文件

致电View-B's B.js

我不能做什么: -

     #1 I can`t embed A.js into View-B
     #2 I can`t embed A.js into _Layout.cshtml

如果可以,请告诉我怎么做?

1 个答案:

答案 0 :(得分:0)

您可以在视图B中使用getScript

$.getScript('jsfile.js',function(){
  //call function A 
});