我有一个部分视图中的DropDownListFor.在更改时它会触发jQuery脚本,但Fiddler显示HTTP 500错误:
- The action 'LanguageListPartial' is accessible only by a child request.
调用脚本:
- <script type="text/javascript">
- $(function () {
- $('#SelectedLanguage').on('change',function () {
- var culture = $(this).val();
- $('#test').load("/Account/LanguageListPartial/" + culture,function () {
- location.reload(true);
- });
- });
- });
- </script>
我不希望直接调用Controller Action,因此它使用[ChildActionOnly]进行修饰.我意识到它是用jQuery .load()直接调用的.
有没有办法保持ChildActionOnly限制,仍然使用.on(‘change’…)事件从jQuery调用它?