December 8th, 2012, 06:46 PM
How To Open File And Load Contents Into A Variable
in my PHP webpage I specify 3 files, like:
then I have a JS fuction, that in some points, needs to open each file and store the data of each file into a variable. My questions are 2:
$first_file = $_POST["one"];
$second_file = $_POST["two"];
$third_file = $_POST["three"];
First, how do I save all data of each text file into a JS variable?
Second, the part of the Js function which has these variables looks like this:
Can you please help me, how I can put the data of each file into the correct place? I am new to JS and came across a helpful snipet of code, but I do not know how I can place my data inside the JS code so as to use them.
HERE WE SHOULD PLACE ALL DATA FROM FILE 1
HERE WE SHOULD PLACE ALL DATA FROM FILE 2
HERE WE SHOULD PLACE ALL DATA FROM FILE 3
Thanks a lot!
December 12th, 2012, 01:43 PM
Re: How To Open File And Load Contents Into A Variable
var jsVariable = "<?php echo $phpVariable; ?>";
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Click Here to Expand Forum to Full Width