1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

jquery Ajax に連想配列で渡したいけど渡らない時

Posted at
error

//↓この配列を渡したい 
var paramData = [];
paramData['a'] = "aa";
paramData['b'] = "b";

var result = $.ajax({
		type : "GET",
		url : "/api/index.php",
		async: false,
		data :paramData
	}).responseText;

document.write(result);

paramData を「/api/index.php」に渡したいけど渡らない、、

ok
//配列の初期化が問題でした
//↓これにしたらOK
var paramData = {};

paramData['a'] = "aa";
paramData['b'] = "b";

var result = $.ajax({
		type : "GET",
		url : "/api/index.php",
		async: false,
		data :paramData
	}).responseText;

document.write(result);

これ、何が違うのだろう?後日調査。
var paramData = [ ];
var paramData = { };

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?