次の URL があります。
http://mydomain/Forwards?searchValue[]=Nike+Webstore&searchValue[]=Bodyman&category_filter[]=Animals+%26+Pet+Supplies&category_filter[]=Fashion&country_filter[]=Aland+Islands&country_filter[]=American+Samoa
この URL には、配列として送信される多くのパラメーターが含まれています。
今、個々の配列とその値を取得したい
上記の例では、結果は次のようになります。
searchValue = array(
[0] = 'Nike Webstore'
[1] = 'Bodyman'
);
category_filter = array(
[0] = 'Animals & Pet Supplies'
[1] = 'Fashion'
);
country_filter = array(
[0] = 'Aland Islands'
[1] = 'American Samoa'
);
このようにそれを取り出すことは可能ですか?私は次のことを試みました:
decodeURIComponent(
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
ただし、これは私の例では 1 つの値 (Nike Webstore) のみを返しました。