1

我正在尝试将参数中的数据解析到数据库中。在 IE、Opera、chrome 中一切正常。在Mozilla不工作,写错误SyntaxError: JSON.parse: unexpected character

下面是代码解析:

$.getJSON("<?php echo JURI::base()?>ajax.php?get=1&param="+param,function(data){
                    if(data)
                    {

                buildPopup(data.member_from,data.member_amount);
                            //$("body #scorepopup").fadeIn("slow");
                        var ww = $(window).width();
                        var wh = $(window).height();
                        var spw = $("body #scorepopup").width();
                        var sph = $("body #scorepopup").height();
                        var spt = Math.round(wh/2-sph/2);
                        var spl =  Math.round(ww/2-spw/2);
                        $("body #scorepopup").css("top",0);
                        $("body #scorepopup").css("left",spl);
                        $("body #scorepopup").show();
                        $("body #scorepopup").animate({top:spt+"px"},600, 'easeOutBounce'); 

                    }
                }
)

函数 BuildPopup

function buildPopup(member_from,member_amount){
            if($("body #scorepopup").length) {
                $("body #scorepopup").remove();
            }
            $("body").append('<div id="scorepopup"><div class="ds-point">'
                    +'<?php echo JText::_('STAN') ?>'
                    +'&nbsp;<b>'
                    +member_from
                    +'</b><br/>'
                    +'<?php echo JText::_('POINT') ?>'
                    +':&nbsp;<b>'
                    +member_amount
                    +'</b></div><div id="closescorepopup"></div></div>'
            );
        };

来自谷歌浏览器的响应文本:

{"id":"89095","member_no":"89095","username_m":"00047","group_id":"1","dsgid":"31","user_id":"0","member_amount":"91","title":"\u041a\u043b\u0456\u0454\u043d\u0442 dsuser89095","first_name":"dsuser89095","last_name":"\u041a\u043b\u0456\u0454\u043d\u0442","address":"","zip_code":null,"city":null,"county":null,"country":null,"telephone1":"","telephone2":null,"fax":null,"email":"89095ds@ds.com.ua","website":null,"profession":null,"birth_date":"0000-00-00","additional_info":"\u041a\u043b\u0456\u0454\u043d\u0442","member_from":"2013-07-04","member_until":"0000-00-00","committee_info":null,"images":"","last_payment_date":"0000-00-00 00:00:00","suspended":"0","published":"1"}

来自 Firefox 的响应文本:

п»ї{"id":"89095","member_no":"89095","username_m":"00047","group_id":"1","dsgid":"31","user_id":"0","member_amount":"91","title":"\u041a\u043b\u0456\u0454\u043d\u0442 dsuser89095","first_name":"dsuser89095","last_name":"\u041a\u043b\u0456\u0454\u043d\u0442","address":"","zip_code":null,"city":null,"county":null,"country":null,"telephone1":"","telephone2":null,"fax":null,"email":"89095ds@ds.com.ua","website":null,"profession":null,"birth_date":"0000-00-00","additional_info":"\u041a\u043b\u0456\u0454\u043d\u0442","member_from":"2013-07-04","member_until":"0000-00-00","committee_info":null,"images":"","last_payment_date":"0000-00-00 00:00:00","suspended":"0","published":"1"}

作为 Firefox 的回应,开头有一些不可读的字符:п»ї

哪儿来的呢?可能通过它们在 Firefox 中不起作用。我会很高兴得到任何帮助

4

0 回答 0