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 Quote Link to comment 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%.. Quote Link to comment 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.