Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

233
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!