0

I m in a situation where i need to call a action method of different controller

I mean I am currently in controller 'Wk' action -History's On this view when i click any link then an ajax call will call the action method of different controller. But the ajax call calls the action method of the same controller.

the jquery is -

$.get("History/20/5/2", function (data) {
                $("div#dShow").html(data);
                $("div#dShow").dialog({
                    opacity: 0,
                    height: 700,
                    width: '1024px',
                    show: 'blind',
                    hide: 'blind'
                }).animate({
                    opacity: 1
                }, 3000, function () {
                    // Animation complete.
                });
            });

1 Answer 1

1

You need to tell it what action to call on the history controller:

$.get("History/Index/20/5/2", function (data) {
            $("div#dShow").html(data);
            $("div#dShow").dialog({
                opacity: 0,
                height: 700,
                width: '1024px',
                show: 'blind',
                hide: 'blind'
            }).animate({
                opacity: 1
            }, 3000, function () {
                // Animation complete.
            });
        });
Sign up to request clarification or add additional context in comments.

5 Comments

here history is my controller name
@user1006544 So what is the action name? 20?
Here action name is Index so I think it dosent need to mention the index thats y i havent mentioned the action
Unless you have a very specific route set up for this exact situation you will need to specify the action name as well. Otherwise mvc cannot work out which controller you want. Updated answer to reflect this.
I have changed that but it is not calling the action of History Controller

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.