list of variables

Discussion and feedback on Construct 2

Post » Fri May 18, 2012 1:34 am

Personally, I'm doing an application that sends a variable to a server via ajax. There is the possibility of sending a list of variables?
B
2
Posts: 11
Reputation: 272

Post » Fri May 18, 2012 7:53 am

Yes, you can separate variables in this format:

a=value1&b=value2&c=value3...
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Sat May 19, 2012 1:40 am

would not have anything like a HashMap?
B
2
Posts: 11
Reputation: 272

Post » Sat May 19, 2012 2:16 pm

one posibillity -
hashmap {foo: 1, bar:2}
1) convert it to one String/Text:
myHM= "foo:1|bar:2"
2) send it as one value
myScript.php?hashMap=myHM
3) extract the values back with php - splitting/parsing..

another possibility is converting your datas to a JSON-String and send this string,.. then php can simple extract the data (http://www.php.net/manual/en/function.json-decode.php)
Joe72012-05-19 14:17:21
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Tue May 22, 2012 1:13 pm


I did so

list = {1:1, 2:2, 3:3, 4:4, 5:5}

<php
$ list = $ _GET ['list'];
$ test = var_dump (json_decode ($ list));
echo $ test [0]
?>

But it did not work. There appeared nothing
B
2
Posts: 11
Reputation: 272

Post » Tue May 22, 2012 2:56 pm

I need to stay that way in php

$test = array("test1" => array(1 => 1),"teste2" => array(2 => 1, 2 => 2),"teste3" => array(3 => 1, 3 => 3));

i try send a string, but not sucessful
B
2
Posts: 11
Reputation: 272

Post » Wed May 23, 2012 9:00 pm

Somebody?
B
2
Posts: 11
Reputation: 272


Return to Construct 2 General

Who is online

Users browsing this forum: 8tomo8, akash15, chadorireborn and 13 guests