c# - Is the only way to use 'params' in a controller action to give it an array from JavaScript? -


i have method within controller:

[httpget] public jsonresult getpreference(params string[] settings) {     // things related getting preferences     return json(preferenceslist); } 

is means pass parameters method ajax call array? there more graceful or elegant methods?

$.get(url, { settings: [color, rotation] }); 

i think should able along lines of this:

get /somecontroller/getpreference?settings%5b0%5d=first&settings%5b1%5d=second 

(where %5b [ , %5d ]) or just

get /somecontroller/getpreference?settings=first&settings=second 

see this post hanselman , this 1 haack.

the former useful if want use complex types rather string or int.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -