I have following javascript function in my HTML document:
function jsFunction(string, jsonArray, string) { ... }
An example of jsonArray would be following:
[
{"name":"foo", "value":"21980"},
{"name":"bar", "value":"100"},
{"name":"foo", "value":"27492328"},
{"name":"bar", "value":"WEB21980001831"}
]
I followed the instructions from the post "Creating an JSON array in C#" in order to create a JSON Array object in C#.
From my Windows Form I should be able to call the JavaScript function like this:
Object[] jsParams = new Object[3];
jsParams[0] = (Object)"test";
jsParams[1] = new
{
items = new[] {
new {name = "foo" , value = "21980"},
new {name = "bar" , value = "100"},
new {name = "foo" , value = "27492328"},
new {name = "bar" , value = "WEB21980001831"}
}
};
jsParams[2] = (Object)"test";
this.webBrowserCtl.Document.InvokeScript("jsFunction", jsParams);
However, it doesn't work. Did I forget something?