I have a variable/flag in a PHP file and depending upon the value of this flag i need to execute a set of code in another .js file. Can you tell me how to access the variable in .php file inside a .js file? Please find attached the sample js file i am using. I need to execute the set of code inside this file depending on the value of the flag.
dinilkarun
8
Posting Whiz in Training
Recommended Answers
Jump to PostI would suggest changing 'sample.js' to 'sample.php' then use sessions to transfer the value and echo the value into the file. A sample is as below and make sure the first line is exactly the same:
<? session_start(); ?> //to display the value in …
All 4 Replies
cwarn23
387
Occupation: Genius
Team Colleague
Featured Poster
dinilkarun
8
Posting Whiz in Training
John11
0
Newbie Poster
cadillacwd
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.