var MyData = {};
MyData[$a] = x;

data: MyData


And just to note, common practice shown in the jQuery library and
plugins is that variables starting with "$" are ones that are jQuery
objects.....  not that you *have* to do it, but it would make sense to
follow what others are doing


On Feb 20, 9:14 am, "David .Wu" <chan1...@gmail.com> wrote:
> if we want to transfer some variable to another page by ajax, we use
> data: {a: 1, b: 2}
> and it will send like xxx.php?a=1&b=2
>
> but if a is not a constant variable, such as
> var $a = x
> data: {$a: 1} I want it become xxx.php?x=1
> var $a = y
> data: {$a: 1} I want it become xxx.php?y=1
>
> how to do that?

Reply via email to