Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

235
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda