farmallnerd Posted May 30, 2013 Share Posted May 30, 2013 Hello, I am having trouble using Javascript with my PHP app. I have only ever written some very basic php apps before so it is probably something simple that is going on. Basically in the PHP I am doing a SELECT to a mysql database to find some values and I would like to use the JQuery progressbar (or any progressbar) and plug these values in so that the progressbar fills in that amount. In the while statement I can get the outline of the bar but it will not show the value. I thought I would test the call to that function so I commented out the value portion and added an alert instead but the page never shows that alert either so there as got to be something wrong in the way I am calling it? while($row=mysql_fetch_array($result)){ $percentValue = $row['percValue']; echo '<div id="progressbar"></div>'; } <script> $(function(){ $("#progressbar").progressbar({ value: <?php $percentValue; ?> }); }); </script> Thanks in advance for any help you can offer! Quote Link to comment Share on other sites More sharing options...
Irate Posted May 30, 2013 Share Posted May 30, 2013 You are sure that you have jQuery and the appropriate plugin installed on your Operating System? You can try echoing out the script via PHP if that doesn't work, too. Quote Link to comment Share on other sites More sharing options...
DavidAM Posted May 31, 2013 Share Posted May 31, 2013 You cannot execute JavaScript in a PHP script; and you cannot execute PHP in a JavaScript script. PHP is a server-side scripting language. It executes to completion and sends something to the browser. JavaScript is a client-side scripting language. It executes in the browser -- but only AFTER PHP is completely done. 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.