J
J
jamster2019-03-12 01:03:04
JavaScript
jamster, 2019-03-12 01:03:04

How to properly process JSON?

Good day.
In general, there is a JSON response from the PHP server.
I get AJaxom response processing Php script.
JS does not give the entire amount of data
The script itself.

$.ajax({

 url: 'url',
 type: 'POST',
        dataType: 'json',
        cache: false,
        data: obj,

      })

      .success(function(data) {
        
        // var dataDecode = JSON.parse(data);
        console.log(data);
        var dataObj = data.doctors[0].day;

        let arrayLength = dataObj.length;

        let getWeek = dataObj.length / 7;
        let getweekNum =  Math.floor(getWeek);

        console.log(data.doctors[0]);

5c86df3212065582008440.png
Red indicates the actual number of elements in the array, but the value in the object is different.
In network -> XHR - preview Everything is clear, as it should be 11 elements in the array.
but actually less.
It does not matter the actual number of emails received from the server.
In the end, some of them still disappear.
Here is the console outputting DATA
5c86e16a27b3c675416617.png
A Here is the answer from the browser's point of view.
5c86e1802f04a444002375.png
THANK YOU FOR YOUR ATTENTION!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question