Palastia Posted August 26, 2012 Share Posted August 26, 2012 Hey everyone. Is it possible to reload a page without losing data? The reason why I need this because in my scenario, I am inserting data (mathml) from a pop window into CKEditor text area and a plugin within CKEditor actually converts the mathml data into an image. But in order to do this, I need for the page to reload again after inserting the raw mathml to turn it into an image. So I need to be able to reload the page and keep the data within the CKEditor textarea. I have done quite a fair bit of research and stumbled upon the Ajax load function. But I am unsure if it can be used in my scenario. I would appreciate if someone could provide me with some advice and point me in the right direction. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/267587-reloading-a-page-without-losing-data/ Share on other sites More sharing options...
trq Posted August 26, 2012 Share Posted August 26, 2012 The entire point of Ajax is that you can use it to make server requests in the background, and then insert the data returned into the current page without having to reload the entire page. Quote Link to comment https://forums.phpfreaks.com/topic/267587-reloading-a-page-without-losing-data/#findComment-1372519 Share on other sites More sharing options...
Palastia Posted August 26, 2012 Author Share Posted August 26, 2012 Thank you for replying. But how exactly can I achieve this in my scenario? Quote Link to comment https://forums.phpfreaks.com/topic/267587-reloading-a-page-without-losing-data/#findComment-1372520 Share on other sites More sharing options...
Christian F. Posted August 26, 2012 Share Posted August 26, 2012 You don't need to reload the page, you just need to fire CKEditor's update functions. The ones that normally gets fired when you write normally in the field. You might even succeed with firing the insitric event itself from within your script, so you might want to try that first. Quote Link to comment https://forums.phpfreaks.com/topic/267587-reloading-a-page-without-losing-data/#findComment-1372549 Share on other sites More sharing options...
Palastia Posted August 26, 2012 Author Share Posted August 26, 2012 Hey christian thanks for replying! Based on what I've read on CKEditor's API documentation, the only instance that I can use for this is UpdateElement();? I tried this once but it did not work. I suspect probably Im not sure where to use it and didn't write the code correctly. Quote Link to comment https://forums.phpfreaks.com/topic/267587-reloading-a-page-without-losing-data/#findComment-1372552 Share on other sites More sharing options...
Christian F. Posted August 26, 2012 Share Posted August 26, 2012 I'm not familiar with CKEditor myself, I'm afraid, but have you tried manually calling the "keyup" insitric event (on the editor element) after inserting the code? Quote Link to comment https://forums.phpfreaks.com/topic/267587-reloading-a-page-without-losing-data/#findComment-1372585 Share on other sites More sharing options...
Palastia Posted August 26, 2012 Author Share Posted August 26, 2012 I apologize for my ignorance, but what exactly is the "keyup" insitric event (on the editor element)? Please forgive me, Im rather new to coding altogether. Edit: So I just looked up the keyup event but how exactly can I use this to preserve the data upon reloading the text area? Quote Link to comment https://forums.phpfreaks.com/topic/267587-reloading-a-page-without-losing-data/#findComment-1372589 Share on other sites More sharing options...
Christian F. Posted August 26, 2012 Share Posted August 26, 2012 The trick is that you don't reload the text area, but trick CKEditor to thinking that you've manually added the data. Thus letting it do all the work for you. Quote Link to comment https://forums.phpfreaks.com/topic/267587-reloading-a-page-without-losing-data/#findComment-1372593 Share on other sites More sharing options...
Palastia Posted August 26, 2012 Author Share Posted August 26, 2012 I see. But I think the CKEditor text area needs to sort of reload. I tested location.reload upon inserting mathml into CKEditor from a popup window and it worked (the mathml becomes an image from a plugin within CKEditor), but only in FireFox, since it supports forward-back caching and no javascript states are actually lost. Other browsers just reloaded the page entirely without the mathml data in textarea. Where should I use the onkeyup event to make it work? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/267587-reloading-a-page-without-losing-data/#findComment-1372596 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.