canadabeeau Posted December 20, 2009 Share Posted December 20, 2009 I need a javascript which will refresh once the current page after a bunch of PHP functions have run Quote Link to comment https://forums.phpfreaks.com/topic/185752-single-refresh/ Share on other sites More sharing options...
trq Posted December 20, 2009 Share Posted December 20, 2009 php functions execute on the server side before the page is even generated so.... Quote Link to comment https://forums.phpfreaks.com/topic/185752-single-refresh/#findComment-980827 Share on other sites More sharing options...
canadabeeau Posted December 20, 2009 Author Share Posted December 20, 2009 yes exactly the JS is being placed into a PHP function Quote Link to comment https://forums.phpfreaks.com/topic/185752-single-refresh/#findComment-980829 Share on other sites More sharing options...
trq Posted December 20, 2009 Share Posted December 20, 2009 Still, your question makes little sense. You need to be allot more descriptive. Quote Link to comment https://forums.phpfreaks.com/topic/185752-single-refresh/#findComment-980830 Share on other sites More sharing options...
canadabeeau Posted December 20, 2009 Author Share Posted December 20, 2009 back on my MAC thingo which you helped me out with alot, I have the JS output and am putting it into PHP then echoing but it doesnt echo till I refresh, so I need to refresh the page once automatically Quote Link to comment https://forums.phpfreaks.com/topic/185752-single-refresh/#findComment-980831 Share on other sites More sharing options...
trq Posted December 20, 2009 Share Posted December 20, 2009 Ah, I remember the mac thingy. Your problem there was you where setting a php session variable via an ajax call and expecting it to refresh the data in the page automatically. As I said in that thread, you need to print your response using javascript to have it actually update the current page. If you read a little bit about ajax and how it works I'm sure you would have a better understanding. Quote Link to comment https://forums.phpfreaks.com/topic/185752-single-refresh/#findComment-980835 Share on other sites More sharing options...
canadabeeau Posted December 20, 2009 Author Share Posted December 20, 2009 thats not exactly helpful Quote Link to comment https://forums.phpfreaks.com/topic/185752-single-refresh/#findComment-980837 Share on other sites More sharing options...
trq Posted December 20, 2009 Share Posted December 20, 2009 I'll post a simple example that illustrates how to update the content of a div using jQuery and Ajax. From there I should expect that you'll do some investigating of your own so you don't have to keep asking these questions. index.php <html> <head> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script> $(document).ready(function() { $.ajax({ type: "POST", url: "process.php", dataType: "html", success: function(d) { $('#content').html(d); } }); }); </script> </head> <body> <div id="content"> <p>This is the initial content.<p> <div> </body> </html> process.php <?php echo "<p>This is ajax requested content</p>"; ?> Not tested. Quote Link to comment https://forums.phpfreaks.com/topic/185752-single-refresh/#findComment-980843 Share on other sites More sharing options...
canadabeeau Posted December 20, 2009 Author Share Posted December 20, 2009 since I put jQuery in my Java has had errors and it is only when I have jQuery in, why? Quote Link to comment https://forums.phpfreaks.com/topic/185752-single-refresh/#findComment-980844 Share on other sites More sharing options...
trq Posted December 20, 2009 Share Posted December 20, 2009 Java applets are self contained, jQuery could not effect them. What are the errors exactly? Quote Link to comment https://forums.phpfreaks.com/topic/185752-single-refresh/#findComment-980845 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.