The number after the decimal point of the data requested by jsonp is gone.

in a project, I tried to obtain the data of Douban API through jsonp, but found that the score changed from 7.1 to 6.

related codes

$(document).ready(function(){
    if($("-sharpdouban_score").length > 0) {
        var name = "";
        $.ajax({
            type: "get",
            dataType: "jsonp",
            jsonp:"callback",
            timeout: 5000,
            url: "http://api.douban.com/v2/movie/search?q="+ name +"&count=1",
            error: function(){
                alert("");
            },
            success:function(data){
                if(data.subjects[0].rating.average!=0){
                    $("-sharpdouban_score").text(data.subjects[0].rating.average)
                }
            }
        })
    }
});

part of the data obtained by jsonp:

clipboard.png

json

clipboard.png

it seems to be compressed. How can I not compress this data?

Oct.20,2021

if you want to keep the decimal point of the returned data, you can use toFixed (digits)

   
I have exactly the same code here. If you don't reproduce your problem, you can check whether it is the jq version

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ba6c-2ba2a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ba6c-2ba2a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?