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

234
Vistas
JSON String value not return in View ASP.net MVC

Hi I am trying to return string value based on what I entered in txtInput, and will show in txtOutput

 <input id="txtInput" class="form-control">
   <input id="txtOutput" class="form-control">

below is my function

  function GetOutput(output) {
    var data = JSON.stringify({
        output: output
    });
    $.get('GetOutput', data, function (data) {
        $("#txtOutput").val(data);
    }).fail(function (jqXHR, textStatus) {
        alert(`Error = ${jqXHR.status} ${textStatus}`);
    });

}

Below is my controller:

[HttpGet]

public JsonResult GetOutput(string output)
{
    var po = db.Datas.SingleOrDefault(items => items.number== output);
    return Json(po, JsonRequestBehavior.AllowGet);
}

I have an existing string : abc, but when I type in input abc it is not showing on the output but intead returning - Error = 200 parsererror

below is my code to display value in the output:

   $("#txtInput").change(function () {

            var a = $("#txtInput").val();

            GetOutput(a)
        });

Please help suggest where I went wrong on the above codes. Thank you in advanced!

about 4 years ago · Juan Pablo Isaza
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