Gil Ronen Posted May 26, 2019 Posted May 26, 2019 I want to load an editor with an ajax request and when the ajax request is sent and the editor looks like this: How can I fix it? Thanks
bfarber Posted May 28, 2019 Posted May 28, 2019 Do you have any errors in your browser console? Are you using Cloudflare with "Rocket loader" enabled by chance? This will break editors loaded via AJAX (a built in example would be when you attempt to send another user a PM, the form to send the PM opens up in a modal, loaded via AJAX - does that work, or is that broken too on your site?).
Gil Ronen Posted May 29, 2019 Author Posted May 29, 2019 21 hours ago, bfarber said: Do you have any errors in your browser console? Are you using Cloudflare with "Rocket loader" enabled by chance? This will break editors loaded via AJAX (a built in example would be when you attempt to send another user a PM, the form to send the PM opens up in a modal, loaded via AJAX - does that work, or is that broken too on your site?). I'm working on localhost, no errors in console.
Gil Ronen Posted May 29, 2019 Author Posted May 29, 2019 5 hours ago, bfarber said: Does the editor work in the messenger? The editor works, it works also in the same page on the first content that loads without ajax. when new content is loaded with ajax the editor in the ajax content doesnt work.
bfarber Posted May 29, 2019 Posted May 29, 2019 My guess based on what you are describing is that there's an HTML element ID conflict, i.e. on the first page you have <textarea id='xyz'></textarea> that is turned into an editor, and then on the second page that editor hasn't been destroyed, but you have a new <textarea id='xyz'></textarea> If that is the case, your two basic options are: 1) Ensure you fully destroy and remove the editor from the page before loading page 2 (preferred) 2) Use a unique field name/id for each page to prevent conflicts (this would just be a workaround and not the ideal solution)
Gil Ronen Posted May 29, 2019 Author Posted May 29, 2019 1 hour ago, bfarber said: My guess based on what you are describing is that there's an HTML element ID conflict, i.e. on the first page you have <textarea id='xyz'></textarea> that is turned into an editor, and then on the second page that editor hasn't been destroyed, but you have a new <textarea id='xyz'></textarea> If that is the case, your two basic options are: 1) Ensure you fully destroy and remove the editor from the page before loading page 2 (preferred) 2) Use a unique field name/id for each page to prevent conflicts (this would just be a workaround and not the ideal solution) Thats the code for the editor, I have a page with an editor loaded and working and if you do an action an ajax request loads another editor. the only simmilar thing is the editor name("comment") and the key.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.