Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

86
Vistas
Is it possible to update only one property of a model using AJAX?

I have a model, JobApplicationForm. This model is split into a short app and a long app. Meaning the 1st page posts certain attributes to the model, and once the last 3 pages are finished another post updates the model to be completely filled out.

public class JobApplicationForm
{
    public int Prop1 {get; set}
    public string Prop2 {get; set;}
    public string Prop3 {get; set;}
    public string Prop4 {get; set;}
    public string Prop5 {get; set;}
    public int CompletionStatus {get; set;} 
}

In the 1st Post action, the model fills Prop1 and Prop2, and sets CompletionStatus = 1. This is a post after 1 page of the form is completed.

Then in the 2nd Post action, there are 3 more pages that fill in Prop 3, 4, 5, and sets CompletionStatus = 4 when the final page is submittmed.

Since the 2nd part of the form is 3 pages that come together. Is there a way to use AJAX to simply update completionStatus to 2 and 3 on their respective pages? When trying to post using AJAX I have found online that the model has to be fully filled out, and am unable to find anyone just updating one property. I am not trying to update the view at all when changing completionStatus, just simply trying to update the model's property.

Ajax(status is an int variable defined elsewhere)

    $('.next.button').click(function() {
    $.post('/Home/UpdateCompletionStatus', {completionStatus : status});
});

3rd Controller I created to update this one property.

[HttpPost]
public ActionResult UpdateCompletionStatus([FromBody]JobApplicationForm model, int status)
{
    if (ModelState.IsValid)
    {
        model.CompletionStatus = status;
    }
    return new EmptyResult();
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I solved my own problem. The reason it wasn't updating was because the model binding is confused. I called the paramater status in the controller but then in the ajax called it completionStatus.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda