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 8680425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:14:56+00:00 2026-06-12T21:14:56+00:00

I am developing a web site using MVC 3 razor, in which I have

  • 0

I am developing a web site using MVC 3 razor, in which I have the following situation:

  1. A controller method:
public ActionResult MyControllerMethod(int parameter){
    ''go to bd a do some staff
    IList<My_Custom> datafromDB = MyService.GetData(parameter);           

    'returns to my string tuped view
    return View(datafromDB );
}
  1. A strong typed view in which I use JavaScript:
       @model IList<My_Custom>
        
        <script type="text/javascript">
        
         function getData()
         { 
           var parameter = document.getElementById('myParamater').value;  
    
           $.get('/MyController/MyControllerMethod/' + parameter, function (data) {
                                   
              loadData();
    
           }
           );
       }
       
        function loadData() 
        { 
          clearData();
              
          datos = @Html.Raw(Json.Encode(Model));  
          
          //do some stuff with datos
          
        }
    
        </script>

The JavaScript call to the controller works fine but my problem is that the string typed view seems like is not taking the new value for the @model, so keeps loading the same information.

Although I have debugged the action controller and it returns different data every time.
So is there any way to refresh the Model value of a string typed view?

I also tried to process the data value of that line

$.get('/MyController/MyControllerMethod/' + parameter, function (data) {

but I wasn’t successful doing that.

  • 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-06-12T21:14:58+00:00Added an answer on June 12, 2026 at 9:14 pm

    Your action return view, that’s why nothing works. How your code works:

    • Load data in action, then generate view with json on the page
    • Send requst to the server and receive html with json (all this data are in memory),
      then you access json from first step

    How it must work:

    • Create view
    • Send request to the server (another method, that returning Json)
    • Access data
        public ActionResult YourJsonAction(int parameter)
        {
            IList datafromDB = MyService.GetData(parameter);
            return Json(datafromDB, JsonRequestBehavior.AllowGet);
        }
    
        function getData() 
        {  
           var parameter = $('#myParamater').val();   
           $.get('/MyController/YourJsonAction/' + parameter, function (data) { 
              //data from YourJsonAction
           }); 
        }
    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a Web Site using ASP.NET MVC 3, Nowadays I need to encrypt
I am using ASP.NET MVC for developing a web site. I am using jquery
I am developing a website using MVC 3, I have a web setup project
I am developing a php web site. Here I have implemented clean URL using
I'm using Entity Framework 5 on ASP MVC 4 web site I'm developing. Because
I am developing a web site using ASP.NET MVC. The site will be similar
I am developing web site using jQuery and other tech. I have problem in
I am developing a mathematics site using Asp.Net MVC 3 + Razor + MathJax.
I'm developing web site that loads pages dynamically using the .load function. For example:
I'm developing a mobile site using IUI . It's a framework that makes web

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.