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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:47:20+00:00 2026-05-29T10:47:20+00:00

I’m trying to create an MVC view that will display some data in a

  • 0

I’m trying to create an MVC view that will display some data in a number of tables and then allow that data to be updated by hitting a submit button on the table to be updated. at the point the table is updated, the records in the table may move from one table to the next (this is all be handled in the service layer, not the view). At present, I have the view being rendered from the controller and each of the tables is a separate partial view displaying the data to the user. My update is intercepted by a jQuery method which captures the data from the table and then posts it to the controller as a JSON string. The controller then deserializes the JSON and posts it to the service layer.

What I’d like to then happen is the controller to return a view result which will refresh the whole page, updating the each table so that it displays the appropriate records. I have everything working apart from the page refresh – my controller returns a view result and both the view and model are correct at the point of return, however the page isn’t refreshing as I’d expect it to.

I think I’m missing something daft, but at the minute I can’t see what it is…

Code —

jQuery script on the view:

function DailyPaymentIn(payInId, payOut, notes) {
  this.PayInId = payInId;
  this.PayOut = payOut;
  this.Notes = notes;
}

$(function () {
  $('#update-yes-payments').submit(function (e) {
    e.preventDefault();

    var payments = new Array();

    $('#payment-table-yes tbody tr').each(function () {
      var payInId = $('input#PayInId', this).val();
      var payOut = $('input#PayOut', this).is(':checked');
      var notes = $('input#payment_Notes', this).val();

      payments.push(new DailyPaymentIn(payInId, payOut, notes));
    });

    $.get('/payments/UpdatePayments', { json: JSON.stringify(payments) });
  });
});

The above is capturing values into an object, and then serialising that into JSON. This is all working – the data is sent to the controller method and is in the correct shape when it arrives. I’ve swapped get for post in experimenting and not had any luck.

Controller Methods:

Method to render the data:

[HttpPost]
public ViewResult PayInAdmin(PayInAdminModel model)
{
    var payments = _autoPayOutService.PopulatePayments(model.PaymentsDate);

    return View("AutoPayOut/PayInAdmin", payments);
}

This is returning the view correctly populated.

Method to update the data:

public ViewResult UpdatePayments(string json)
{
    var updates = Deserialise<List<DailyPaymentInUpdateModel>>(json);

    var model = _autoPayOutService.UpdatePayments(updates);

    return View("AutoPayOut/PayInAdmin", model);
}

This is receiving the JSON and processing it correctly, however when it returns, the page is not updated. Note that the view returned is the same on both controller actions and the return type of the service calls is also identical – I can see a correctly populated model returned in debug.

I’m not sure what the problem is, to my knowledge, this should be returning the view correctly. I’m pretty new to jQuery and MVC 3, so it may well be that I’m going about it the wrong way – whether I should be performing this a different way or whether I’ve just missed something, I’m not sure.

Cheers

  • 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-29T10:47:21+00:00Added an answer on May 29, 2026 at 10:47 am

    If you need to update the entire page, you don’t need to use the $.get, an ajax method.
    Try this instead:

    window.location = '/payments/UpdatePayments?json=' + JSON.stringify(payments);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I need a function that will clean a strings' special characters. I do NOT
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text

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.