biggieuk Posted June 23, 2009 Share Posted June 23, 2009 Hi all, I have created a custom dropdown box which when clicked loads a dynamically generated xml file and populates a DHTML Treeview. This process is currently taking far too long to load the div once clicked (4-6 seconds). Is it possible to somehow use the onload of the page to load this hidden div before the user clicks my dropdown? Simply using the function i have now adds the 4-6 second delay onto the page loading time and the user is unable to do anything until this has loaded. Can this be loaded completely in the background so the user can still interact with the page during this 4-6 sec delay? thanks for any help with this. Quote Link to comment https://forums.phpfreaks.com/topic/163340-using-onload-to-fetch-data-hidden-from-user/ Share on other sites More sharing options...
gevans Posted June 23, 2009 Share Posted June 23, 2009 You can use onload, or if you're using a framework such as jquery specify the function to run once the page has loaded. Set the div to display: none in your css. Where the user used to click to load the div, use a simple function to change the display style of the div to block. That should allow you to load the div once the page has loaded, and when the user clicks it will just show the div as required. Quote Link to comment https://forums.phpfreaks.com/topic/163340-using-onload-to-fetch-data-hidden-from-user/#findComment-861799 Share on other sites More sharing options...
biggieuk Posted June 23, 2009 Author Share Posted June 23, 2009 thanks gevans, would using a jquery function allow this loading to be completed 'behind the scenes' so the user can interact with the rest of the page whilst it loads? thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/163340-using-onload-to-fetch-data-hidden-from-user/#findComment-861872 Share on other sites More sharing options...
Adam Posted June 23, 2009 Share Posted June 23, 2009 Why not generate the content with PHP before any of the page loads? Then you can just make the DIV display when you run the function... Quote Link to comment https://forums.phpfreaks.com/topic/163340-using-onload-to-fetch-data-hidden-from-user/#findComment-861900 Share on other sites More sharing options...
biggieuk Posted June 23, 2009 Author Share Posted June 23, 2009 hi, I am using a DHTML Treeview from dhtml.com which is coded in Javascript so i need to load the generated dynamic tree when the user clicks on the dropdown. I need to do the rendering of the treeview before the user clicks on the dropdown. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/163340-using-onload-to-fetch-data-hidden-from-user/#findComment-861913 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.