robs99 Posted April 3, 2010 Share Posted April 3, 2010 Hello, ive got a slight problem. I'm trying to load a php file with jquery using load() to write entries to a mysql database. I want to keep track of the progress and update a progress bar while the entries are being written. The problem is that all the javascript code inside the php file im loading wont be executed until the file is completely loaded (after all the entries have been written to the db). Is there a way to change the load() function to display the content while its loading and not wait until its finished? I hope you can help me out Thanks in advance Rob Link to comment https://forums.phpfreaks.com/topic/197489-how-can-i-display-a-page-thats-still-loading-with-jquerys-load/ Share on other sites More sharing options...
robs99 Posted April 3, 2010 Author Share Posted April 3, 2010 i cant find the edit button so im going to make another reply.. here is a code example to make it easier to understand: <div id="progressbar"></div> $('#progressbar').progressbar({value: 0}); $('#divAjax').load('addtomysql.php'); addtomysql.php: for ($i=1;$i<=5;$i++) { mysql_query("INSERT INTO test (something) VALUES ('bla')"); $percentage = $i / 5 * 100; echo '<script type="text/javascript"> $('#progressbar').progressbar('option', 'value', " . $percentage . "); </script>'; } since the addtomysql.php file is loaded once its completed it just updates the progressbar to 100%.. Link to comment https://forums.phpfreaks.com/topic/197489-how-can-i-display-a-page-thats-still-loading-with-jquerys-load/#findComment-1036589 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.