0
我传递2个硬编码参数,一个ASP.Net MVC2控制器动作,此代码传递Parmeters到一个ASP.Net MVC2行动:从JQuery的自动完成插件
<script type="text/javascript">
$(document).ready(function() {
$("form#search_for_entity_user input#term").autocomplete({
source: '<%= Url.Action("GetEntitySharedUsers", "Search") %>',
delay: 200,
minLength: 3,
select: function (event, ui) {
$.post('<%= Url.Action("AddSharedUser", "Entity", new { id = "42", snlid="17394" }) %>',
function (data) { })
}
});
});
</script>
这工作得很好,但现在我需要改变在$ .post传入的值来自我的模型,所以我想像下面的代码,但这不起作用。有想法该怎么解决这个吗?
<script type="text/javascript">
$(document).ready(function() {
$("form#search_for_entity_user input#term").autocomplete({
source: '<%= Url.Action("GetEntitySharedUsers", "Search") %>',
delay: 200,
minLength: 3,
select: function (event, ui) {
$.post('<%= Url.Action("AddSharedUser", "Entity", new { id = '<%= Model.EntityId %>', name= '<%= Model.Name %>' }) %>',
function (data) { })
}
});
});
</script>