ahmedm177 Posted January 14, 2008 Share Posted January 14, 2008 hello all, i want to make (please wait...)while results are loading. thanks, Quote Link to comment https://forums.phpfreaks.com/topic/85968-for-experts-how-to-make-loading/ Share on other sites More sharing options...
Ken2k7 Posted January 14, 2008 Share Posted January 14, 2008 You need JavaScript. Quote Link to comment https://forums.phpfreaks.com/topic/85968-for-experts-how-to-make-loading/#findComment-438945 Share on other sites More sharing options...
dbo Posted January 14, 2008 Share Posted January 14, 2008 Depends on the requirements. You'll have to be more specific. At a high level glance I would guess this is more of an Ajax thing and would require PHP and Javascript to work in conjunction. Quote Link to comment https://forums.phpfreaks.com/topic/85968-for-experts-how-to-make-loading/#findComment-438946 Share on other sites More sharing options...
tinker Posted January 14, 2008 Share Posted January 14, 2008 yeah, what are you loading and how? Quote Link to comment https://forums.phpfreaks.com/topic/85968-for-experts-how-to-make-loading/#findComment-438950 Share on other sites More sharing options...
ahmedm177 Posted January 14, 2008 Author Share Posted January 14, 2008 Depends on the requirements. You'll have to be more specific. At a high level glance I would guess this is more of an Ajax thing and would require PHP and Javascript to work in conjunction. i was think that there are way with only php do u know how i make it with javascript, give me any small example. Quote Link to comment https://forums.phpfreaks.com/topic/85968-for-experts-how-to-make-loading/#findComment-438953 Share on other sites More sharing options...
p2grace Posted January 14, 2008 Share Posted January 14, 2008 If you absolutely didn't want to use ajax (although I would recommend using it), inside of the php function you'd have to echo a javascript script that will show the loading symbol, and then at the end of the function echo a javascript function that hides it. Basically it'd be a very simple show/hide that happens at the beginning and end of the function. Simple Example: function sampleFunction(){ echo "<script type='text/javascript'>document.getElementById('loading').style.display = 'block';</script>"; // Run php code here echo "<script type='text/javascript'>document.getElementById('loading').style.display = 'none';</script>"; } Quote Link to comment https://forums.phpfreaks.com/topic/85968-for-experts-how-to-make-loading/#findComment-438959 Share on other sites More sharing options...
roshanbh Posted January 14, 2008 Share Posted January 14, 2008 let suppose the div's id is "loadingdiv" then you can do like this in javascript for that $('loadingdiv').innerHTML='Loading.....Please wait'; Thats all dude... Quote Link to comment https://forums.phpfreaks.com/topic/85968-for-experts-how-to-make-loading/#findComment-438963 Share on other sites More sharing options...
Ken2k7 Posted January 14, 2008 Share Posted January 14, 2008 let suppose the div's id is "loadingdiv" then you can do like this in javascript for that $('loadingdiv').innerHTML='Loading.....Please wait'; Thats all dude... That doesn't work. Wrong jQuery usage too. But roshanbh does bring up the most used way of doing this. With the div id being 'loadingdiv': document.write("<div id='loadingdiv'>Loading...Please wait</div>"); Then under that, you can have something like: var something = "FILL IT IN! YOU CAN USE PHP TO GENERATE THIS TEXT"; document.getElementById("loadingdiv").innerHTML = something; Quote Link to comment https://forums.phpfreaks.com/topic/85968-for-experts-how-to-make-loading/#findComment-438968 Share on other sites More sharing options...
ahmedm177 Posted January 14, 2008 Author Share Posted January 14, 2008 let suppose the div's id is "loadingdiv" then you can do like this in javascript for that $('loadingdiv').innerHTML='Loading.....Please wait'; Thats all dude... That doesn't work. Wrong jQuery usage too. But roshanbh does bring up the most used way of doing this. With the div id being 'loadingdiv': document.write("<div id='loadingdiv'>Loading...Please wait</div>"); Then under that, you can have something like: var something = "FILL IT IN! YOU CAN USE PHP TO GENERATE THIS TEXT"; document.getElementById("loadingdiv").innerHTML = something; please how can this work ? more explain please Quote Link to comment https://forums.phpfreaks.com/topic/85968-for-experts-how-to-make-loading/#findComment-439002 Share on other sites More sharing options...
Ken2k7 Posted January 14, 2008 Share Posted January 14, 2008 Uh...because it does? I don't know. That's how JavaScript calls the ID and puts text into the node. : S Maybe if you tell me in more explicit details on what you don't understand about that, I can explain it to you. BTW, this needs to be moved. This topic doesn't belong here. Quote Link to comment https://forums.phpfreaks.com/topic/85968-for-experts-how-to-make-loading/#findComment-439003 Share on other sites More sharing options...
ahmedm177 Posted January 14, 2008 Author Share Posted January 14, 2008 Uh...because it does? I don't know. That's how JavaScript calls the ID and puts text into the node. : S Maybe if you tell me in more explicit details on what you don't understand about that, I can explain it to you. BTW, this needs to be moved. This topic doesn't belong here. first i dont know javascript i want when i click on button in my page, something like please wait.. appear thats all so where i can put ur code to do that ? i just have php code file Quote Link to comment https://forums.phpfreaks.com/topic/85968-for-experts-how-to-make-loading/#findComment-439005 Share on other sites More sharing options...
kenrbnsn Posted January 14, 2008 Share Posted January 14, 2008 It can't be done in PHP alone. Period. Ken Quote Link to comment https://forums.phpfreaks.com/topic/85968-for-experts-how-to-make-loading/#findComment-439017 Share on other sites More sharing options...
Ken2k7 Posted January 14, 2008 Share Posted January 14, 2008 first i dont know javascript i want when i click on button in my page, something like please wait.. appear thats all so where i can put ur code to do that ? i just have php code file Where ever you want the text to be. Quote Link to comment https://forums.phpfreaks.com/topic/85968-for-experts-how-to-make-loading/#findComment-439022 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.