문제

I've faced with a next problem:

In our database we have objects with ids, like 4040956363970588323. I'm writing some client-wizard on jQuery for interacting with such objects. Client receives base data about objects trough an Ajax request, like:

$.ajax({
        url: "/api/pages/",
        type: "get",
        dataType: "json",
        data: {"id": site_id},
        success: function(data){
            if (data.success){
                for (var pidx in data.pages){
                    console.log(data.pages[pidx].id);
                    var li = $('<li class="ui-widget-content"></li>');
                    var idf = $('<input type="hidden" id="pid" value="{0}"/>'.format(data.pages[pidx].id))
                    var urlf = $('<input type="hidden" id="purl" value="{0}"/>'.format(data.pages[pidx].url))
                    li.text(data.pages[pidx].title);
                    li.append(idf);
                    li.append(urlf);
                    $("#selectable_pages_assign").append(li);
                }
                pages_was = $("#selectable_pages_assign>li");
            }
            else
                 updateTips(data.message);
        },
        error: function(){
             updateTips("Internal erro!");
        }
})

So, as you see I send data like JSON object (a bit of server code):

return HttpResponse(dumps({
                        "success": True,
                        "pages": [{"id": page.id, "title": page.title, "url": page.image} for page in Page.objects.filter(site = site)]
            }))

According to Firebug, server send right ids in data, but console.log(..) instead of correct id (4040956363970588323), outputs id 4040956363970588000.

Why does this happen?

Without right ids, any chance, that my wizard will work correctly :)

도움이 되었습니까?

해결책

My guess is something is going wrong in the conversion to JSON. When you write the value, you'll probably need to put quotes around it, to make sure it's treated as a string.

다른 팁

CRM Perspective에서 아이디어가 없습니다!그러나 기본적으로 WebPart를 프로비저닝하는 SharePoint에서 페이지를 만들 수 있습니다.

헤더와 왼쪽 NAV 등을 숨기는 pageUrl + "isDlg=1"에 URL을 사용하여 CRM에서 iframe을 작성할 수 있습니다.

CRM에서 볼 수있는 모든 사용자가 SharePoint 페이지에 액세스 할 수 있는지 확인하십시오 (액세스가 거부되지 않음)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top