i have an array of object that i created and populated by JavaScript now i want to send it another page where work is performed on that array but in php so any way to get data of javascript array in php like $phparray = $_Post['javascriptArray'];
Asked
Active
Viewed 704 times
0

Tushar Gupta - curioustushar
- 58,085
- 24
- 103
- 107

user3262732
- 240
- 1
- 4
- 15
-
https://api.jquery.com/jQuery.ajax/ – Tushar Gupta - curioustushar Feb 14 '14 at 17:45
-
Here is a post that covers it - http://stackoverflow.com/questions/5571646/how-to-pass-a-javascript-array-via-jquery-post-so-that-all-its-contents-are-acce – Jay Blanchard Feb 14 '14 at 17:47
2 Answers
0
You can use ajax to send to php file, for example:
var array = ['1', '2', '3', 'four', 'five'];
$.ajax({
url: "/file.php",
method: 'POST',
data: {
dataToSend:array
}
});
and you will receive the array object in php
<? print_r($_POST['dataToSend']?>

Netzach
- 321
- 2
- 13
-1
Use javascript cookies or localstorage
Try this tut: http://www.mosync.com/files/imports/doxygen/latest/html5/localstorage.md.html
Localstorage is only works on > ie8 & all advance browsers
So u have to use localstorage with Persistance js http://pablotron.org/?cid=1557

Jain
- 1,209
- 10
- 16
-
Please provide a code example for the OP. This is more of a comment than an answer. – Jay Blanchard Feb 14 '14 at 17:48
-
Oh yes actually i'm using via mobile so my net is slow thats y i just mention it in short – Jain Feb 14 '14 at 17:50