Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spf.load return undefined #440

Open
TonyGao opened this issue Jun 19, 2017 · 1 comment
Open

spf.load return undefined #440

TonyGao opened this issue Jun 19, 2017 · 1 comment

Comments

@TonyGao
Copy link

TonyGao commented Jun 19, 2017

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') }}"));
});
@athy125
Copy link

athy125 commented Dec 7, 2023

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');
        }
    });
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants