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

135
Views
AJAX response doesn't print in console

I am using AJAX to get form data from Django application and I want to print the response in the console.

    $.ajax({ 
    type: 'GET' ,               
    url: url,              
    data: {'PUITS': PUITSId },
    dataType: "json",
    success: function (response){
        console.log(response)
        var  response = JSON.stringify(response);
        var  response = JSON.parse(response);
        console.log(response.PUITS);
        console.log(response.DUSE);
        console.log(response.CS);

The first console.log(response) gives me the following data:

[{"model": "measure.surveillancedespuits", "pk": 15, "fields": {"PUITS": "1", "DATE_TEST": "2021-09-10", "MODE": "GL", "CS": "1", "SITUATION": "O", "DUSE": "27", "PRES_TBG": "27", "PRES_CSG": "27", "PRES_AVD": "27", "RESEAU_GL": "27", "ANNULAIRE_TECH": "27", "OBSERVATION": "Nothing", "Controle_Pression_ENSP": true, "Test_Puits": false, "Controle_Pression_DP": false, "post_date": "2021-09-10T08:56:16.864Z", "author": "smail"}}]

and I want to print also some individual data from fields like PUITS, DATE_TEST, post_date` in the console but it shows an error!.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

according to your log result, your response is an array not an object. you CANT access array elements using dot(.) operator.

your response array contains only one element at index 0.

const object = response[0]
object.fields.PUITS
about 4 years ago · Juan Pablo Isaza 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!