faure Posted January 24, 2018 Share Posted January 24, 2018 Hello (bonjour from PARIS) <script> I have a function with var abc="REF1"; I have here a <?php I need the value of abc here what is the solution ? (an exemple if possible) ?> </script> Link to comment Share on other sites More sharing options...
dsonesuk Posted January 24, 2018 Share Posted January 24, 2018 Why? php in JavaScript gives impression you want to produce JavaScript code within script tags, why not produce JavaScript code directly. you can only send value of abc to php by using JavaScript to reload the page with ?abc=REF1 querystring if php code is internal, or send to a external php file with same querystring. check out AJAX tutorials. Link to comment Share on other sites More sharing options...
Ingolme Posted January 24, 2018 Share Posted January 24, 2018 You already asked the same question in this thread Link to comment Share on other sites More sharing options...
faure Posted January 25, 2018 Author Share Posted January 25, 2018 DSONSUK WROTE : Why? php in JavaScript gives impression you want to produce JavaScript code within script tags, why not produce JavaScript code directly. you can only send value of abc to php by using JavaScript to reload the page with ?abc=REF1 querystring if php code is internal, or send to a external php file with same querystring. check out AJAX tutorials. can you give me an exemple in ajax to send the value of a element html and retrieve it in a variable like $x= is my question well formuled ? how reload the page in middle of script ? strange ! Link to comment Share on other sites More sharing options...
dsonesuk Posted January 25, 2018 Share Posted January 25, 2018 AJAX https://www.w3schools.com/xml/ajax_intro.asp window.onload https://www.w3schools.com/tags/canvas_drawimage.asp reload or redirect https://www.w3schools.com/js/js_window_location.asp 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