1

How can I pass associative array in the below code. I dont wish to create a variable

uiDialog([MyURL,null,'GET'],false);

Some thing like this

 uiDialog([url:MyURL,data:null,method:'GET'],false);

I know I can do something like

var arr = new Array(5);
  arr["000"]="Rose";
  arr["4"]="Ltd";

And pass this array but I am not interested in that I want a one line code

UPDATE It seams there is no one line solution but if object is not a problem i.e u cant use array function or length you can try this answer Pass associative array to Javascript function

1

2 Answers 2

3
 uiDialog({url:MyURL,data:null,method:'GET'},false);
Sign up to request clarification or add additional context in comments.

4 Comments

This is passing an Object that is not an Array. There are subtle differences.
how can do for a array not object
Looking at the "Brett Walker" solution u can define ur toArray(dict) method and passing its result to uiDialog. e.g.: uiDialog(toArray({url:MyURL, data:null, methid:'GET'}), false);
i know that how can i achieve it in one line
0
var arr = new Array(3);
arr['url']=MyURL;
arr['data']=null;
arr['method']='GET';

uiDialog(arr,false);

1 Comment

As far as I known it is not possible. Sorry.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.