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

Ajax call no longer defaults to 'body' in some cases #2945

Closed
RussBaz opened this issue Oct 6, 2024 · 2 comments
Closed

Ajax call no longer defaults to 'body' in some cases #2945

RussBaz opened this issue Oct 6, 2024 · 2 comments

Comments

@RussBaz
Copy link

RussBaz commented Oct 6, 2024

I have recently updated to 2.x and my code, that used to work, started failing:

htmx.ajax('GET', next, {
    header: config.headers
});

However, if I add an explicit target, it works as it used to:

htmx.ajax('GET', next, {
    target: 'body',
    header: config.headers
});

I have not found this documented. Is this a bug or a missing piece of documentation only?

@MichaelWest22
Copy link
Contributor

I think the issue may be a recent related bug fix for the ajax Helper function to prevent it defaulting to target body when you pass in bad targets/source fixed in #2869 #2878.

I would try testing with 2.0.2 instead of 2.0.3 and see if this resolves your issue. I Think I can fix the logic to handle it better with another PR.

@1cg
Copy link
Contributor

1cg commented Oct 20, 2024

Thank you @MichaelWest22 I will cut another release in November w/ the fix

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

3 participants