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

287
Views
How to display the json message from ajax call

How to display the message from ajax call which is type of object

$(document).ready(function(){
  $('#checkme').on('click', function () {
    //$('#checkme').attr('disabled',true); 
    $.ajax({
      type: "POST",
      url: '../api/api.php',
      data: $('#tmdt').serialize(),
      dataType: "JSON",
      success: function(response) {
        $("#idv").html();
      }
    });
  });
});
$return_msg = array('response'=>array('status'=>"Transaction type is not valid"));

enter image description here

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Given the format of the returned JSON you can use response.status, like this:

success: function(data) {
  $("#idv").html(data.response.status);
}

Note that if the returned string does not contain HTML, then you can use the text() method instead of html().

about 4 years ago · Santiago Trujillo Report

0

Update your front end to..

success: function (response) {
    console.log(response);
    $("#idv").html(response.response.status);
}

Update your backend code to:

$return_msg = array('response'=>array('status'=>"Transaction type is not valid"));

echo json_encode($return_msg);
about 4 years ago · Santiago Trujillo Report
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!