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

Problems extracting DOM to submit #565

Open
FuXual opened this issue Apr 12, 2020 · 2 comments
Open

Problems extracting DOM to submit #565

FuXual opened this issue Apr 12, 2020 · 2 comments
Labels

Comments

@FuXual
Copy link

FuXual commented Apr 12, 2020

This is no bug report or something. I have a problem with the regions object.
Im trying to instead of using an ajax request to send FormData(), to apply the form as hidden input fields before making a submit of the page. My sites flow is to not use ajax for most things, but instead submit the page with data. This is for e.g. tracking, SEO, security (by checking that its not the wrong user doing the request) and so on and so on.

When trying to log out what's in the regions object i can't really get any usefull values/data from there.
Please understand that JS is not my language by birth :)

If i understand it right, the data saved by the ajax call is the clean variant of the HTML? right? Not with all the css classes that ContentTools uses to make its magic.
Like images should not be saved as <div styel="background jada jada../> but as img-tag and such. I have tried now for more than a day to extract something useful to send to my backend, but nothing yet. Please help me out here :)

Thanks a lot in advance!

@anthonyjb
Copy link
Member

Hi @FuXual can you send me an example of your JS that's being used to gather the html to submit to your server. Also have you tried implementing this code from the tutorial? - http://getcontenttools.com/tutorials/saving-strategies#sending-save-requests-to-the-server-with-ajax

@FuXual
Copy link
Author

FuXual commented Apr 14, 2020

Thank you for your answer Anthony! And thank you very much for this great application! Yes, i have read it, but I instead solved it by making my own DOM parser and converter.

This is because that my project im building is a bit different in many ways, and im just using ContentTools as an engine (in some way). Im bypassing most of the functionality and triggers events very differently etc.

I then utilize htmlLawed like functionality (written by me) in the backend to parse it again for other reasons (mostly security reasons). I also have my own version control software in the backend (which is the main project)

Thanks again alot for this piece of software :)

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

No branches or pull requests

2 participants