Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7170573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:14:24+00:00 2026-05-28T15:14:24+00:00

In the file FirstView.cshtml I have an event – clicking to a cell of

  • 0

In the file FirstView.cshtml I have an event – clicking to a cell of a table redirects you to a method:

$.get('@Url.Action("MyMethod", "MyController")', { someParameters });

In the method MyMethod, which is void, I call and event DownloadStringCompleted in which I have:

Response.Redirect(Url.Action("Second", "MyController"));

Second is an action method which returns SecondView. SecondView is my desired view but it never shows on the browser. The breakpoint enters in it, passes it and I get FirstView in the browser.

What could be the reason? Can it be because they are in the same controller?

The methods are like this:
Second return View. In its body, I pass some ViewData parameters.

The event:
I read some JSON data and call the redirection.

The strange thing is that the breakpoint moves through the correct view, but I get the wrong one in my browser.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T15:14:25+00:00Added an answer on May 28, 2026 at 3:14 pm

    Srcee,

    I believe this is due to the fact that your ajax function is ‘done’ once it has hit the MyMethod action. The redirect doesn’t get fired as it’s not part of the pipeline due to the ajax call (at least, this is my basic understanding). An alternative for you would be to do something along the following lines:

    $.ajax({
      url: '@Url.Action("MyMethod", "MyController")',
      data: { id: 123 }, // i.e. someParameters 
      context: document.body,
      success: function(){
         window.location = '@Url.Action("Second", "MyController")';
      }
    });
    

    this is all top of the head stuff and may not work, but is an alternative approach.

    [edit] – based on your later edit, i would actually suggest that you don’t use ajax at all as it’s impossible (as per my comments below) to redirect on the server via an ajax call. see:

    asp.net mvc ajax post – redirecttoaction not working

    and also:

    How can I RedirectToAction within $.ajax callback?

    for confirmation on this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created 2 views named FirstView and SecondView. Both views have nib files.
I have an application called myApplication. It consists of two classes called FirstView and
I have a problem where the button's I have added to .xib file are
I can't seem to get scrollViewDidEndDecelerating called. I have a scrollView with 2 Views
I have an action that I need to have linked to a certain view
In a partial view I load a javascript file like this : <script src=@Url.Content(~/Scripts/Testing.js)
I'm trying to call a method in my FirstViewController that is the File Owner
I have UITabBarController that has two tabs .Every tab load a file from internet
In my Main Window IB file I have a TabBarController and the first controller
file://localhost/C:/Users/kürşat/Desktop/yeni%20site/faq%20-%20Kopya/kopya.html this is my photography tutorial page. I'm did manage to toggle on/off when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.