0
Pass JavaScript array to Php page?
Hello, is it possible To pass a JavaScript array To PHP page ? if it ils, how ? Thanks
4 Answers
+ 2
For instance you can use Ajax in JavaScript to submit your JavaScript variables to PHP.
If you are using jQuery, AJAX is much simpler.
var value = $("#email).val ();
$.ajax ({
method: "POST",
url: "somephpfile.php",
data: {content: value}
});
using this code when a form is submitted (use submit event) you can pass a variable named content to a php file named somephpfile.php
the you can acess the content variable in php using $_POST['content']
+ 1
JSON is used to pass data to and from PHP and JavaScript.
0
this is also a problem for me, cause i know how To decode a JSON but i don't know how To encode it ! i made researchs but i didn't find anything !
0
is there another way without using Ajax ?