faure Posted January 23, 2018 Share Posted January 23, 2018 spirit of my code : <html> here a button on click for script here an element <p with id="demodemo" <script type="text/javascript"> function myFunction() { var abc= "REF1"; document.getElementById('demodemo').innerHTML = abc; ?php here I need abc how ? is there 2 methods ? thanks for your help ?> } </script> </html> Link to comment Share on other sites More sharing options...
niche Posted January 23, 2018 Share Posted January 23, 2018 don't understand your question Link to comment Share on other sites More sharing options...
Ingolme Posted January 23, 2018 Share Posted January 23, 2018 Javascript cannot pass data to PHP. PHP runs first on the server, generates Javascript code and then sends that Javascript code to the browser to be executed. If you need any server-side work done after that then you will have to use AJAX. Here is the AJAX tutorial: https://www.w3schools.com/js/js_ajax_intro.asp Link to comment Share on other sites More sharing options...
faure Posted January 28, 2018 Author Share Posted January 28, 2018 thanks you problem resolved Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now