レスポンス値の取得

Possible Duplicate:
Get query string values in JavaScript

In Java script i have a variable that holds the value &name=John&age=12&roll=2 for ex:

var data =  "&name=John&age=12&roll=2"

これらの3つの値を個別に取得するにはどうすればよいですか?すなわち、名前、年齢、ロールの値

1

4 答え

Split by & leaving out the first & and then by = and get the value at 1

var data =  "&name=John&age=12&roll=2";
var datas =data.substr(1,data.length).split('&');
for(var i =0; i
                    開く Telegram