简体   繁体   中英

Call action method and return new View using Javascript in MVC3

I have a scenario where I need to use javascript to call a action method using parameters and render the view that is returned by the action method. I have seen examples where action method is called and partial view is updated. But I am trying to execute the action method and a new view, can this be done ? please help. thanks

function OnRowSelect(e) {
        var form = $(this);
        var taskInstanceUid = e.row.cells[13].innerHTML;
        var so = e.row.cells[12].innerHTML;
        var tabText;
     $.ajax({
            type: 'POST',
            cache: false
        })
         .success(function (result) {
               $.post("OrderInformation", { taskInstanceUid: taskInstanceUid });
       });

If you are going to update the entire view, couldn't you just direct the user to the URL that return the view?

<script type="text/javascript">
window.location.href = "http://yourdomain.com/controller/action/?parameter1=something";
</script

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM