Here's one way - it's possible, but messy, as you have to use eval. As
far as I can see you can't have a variable variable name, unless
you're evaluating on the fly.

For example:

<script>
var a = { b: 'x' };
var c = { a.b: 123 };
alert(c.x); // hopefully we'll get "123"
</script>

.. doesn't work, because a.b isn't a valid name.

You can do this though:

<script>
var a = { b: 'x' };
eval('var c = {'+a.b+':123}');
alert(c.x);
<script>

And you'll get 123 - but it's a pretty horrible way to do it, and
you'd have real trouble making it work well with jQuery, especially if
the criteria is changing all the time.

On Jan 21, 11:18 am, Mike Geise <[EMAIL PROTECTED]> wrote:
> I am using the ajax load method to populate a select list.
>
> $("#games").load("$siteRoot/file/ajaxgames.aspx",
> {criteria.Platform.PlatformID: $(this).val(), view: "normal"});
>
> what I am wondering is how I can get jquery to work with the var
> "criteria.Platform.PlatformID"
>
> I am doing it this way so I can pass a different var name depending on
> the context, example "criteria.Platform.UrlName"
>
> Any ideas?
>
> Thanks, Mike

Reply via email to