spfjs icon indicating copy to clipboard operation
spfjs copied to clipboard

spf.load return undefined

Open TonyGao opened this issue 8 years ago • 1 comments

Hi, there

I have a try with SPF 24 (v2.4.0), when I use spf.load api, it's return undefined, but the xhr is work normally and the response is proper for me, code below(use in background template system). The question is how can I get the response content and append it to the specific dom, perhaps like pjax way?

$('#append').click(function () {
    $('#title-body').layout('expand', 'south');
    console.log(spf.load("{{ path('admin_org_title_new') }}"));
});

TonyGao avatar Jun 19 '17 04:06 TonyGao

Replace #yourTargetElement with the actual ID or selector of the DOM element where you want to append the content.

$('#append').click(function () {
    $('#title-body').layout('expand', 'south');

    spf.load("{{ path('admin_org_title_new') }}", function(response) {
        if (response) {
            $('#yourTargetElement').html(response);
        } else {
            console.error('Failed to load content');
        }
    });
});

athy125 avatar Dec 07 '23 09:12 athy125