Answer the question
In order to leave comments, you need to log in
How to pass an array from JS to PHP?
I know, the topic is beaten ... and even so, I could not find a solution ....
on the client side I have such an array and pass it to PHP:
var res = [
32,
32,
132,
13.2,
118.8,
'слово на русском'
];
var arr = JSON.stringify(res);
alert(arr);
location.href='http://INSPECTION/CALCMARsaveOk/'+ arr;
echo '<pre>';
var_dump($arr);
var_dump(json_decode($arr));
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
...
Answer the question
In order to leave comments, you need to log in
https://secure.php.net/manual/ru/function.urldecode.php
In general, it is more correct to pass it as a parameter, for example:
var res = [
32,
32,
132,
13.2,
118.8,
'слово на русском'
];
var arr = JSON.stringify(res);
location.href='http://INSPECTION/CALCMARsaveOk/?arr='+ arr;
var_dump($_GET);
"In general, it is more correct to betray as a parameter, for example:"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question