Filter construction
Here is an example of creating a filter
var filter = new Tridion.ContentManager.ListFilter(); filter.conditions.ItemTypes = 16 | 2;
Or this extremely simple case from General.js:
var templateFilter = new Tridion.ContentManager.ListFilter({ conditions: { ItemTypes: [ itemType ] } });
WCF method call
The second part of your question has indeed been addressed at fooobar.com/questions/770785 / ... , although I will make it more specific here.
WCF / AJAX calls, for example, run asynchronously, as they can take some time. Although you usually just process the result of the call in a line after the closing parenthesis, you cannot do this in AJAX calls, since this line will be executed before the function completes. Instead, you need to pass one or more callback functions that are called after the function completes.
Usually I just pass two functions that burst into my browser’s JavaScript JavaScript debugger when I first started figuring out such a method:
Tridion.Web.UI.ContentManager.WhereUsed.GetListUsedItems( "tcm:1-23", filter.conditions, filter.columns, new function() { console.log(arguments); debugger; }, new function() { console.log(arguments); debugger; } );
So, the first (anonymous) function is called when the (asynchronous) HTTP request to the TCM server was successfully executed, and the second is called when the call failed. In the answer above, we named them onSuccess and onFailure to make their nature more explicit.
In this case, both functions simply write the implicit arguments parameter, which is always passed in JavaScript. Then they go into your browser's JavaScript debugger, so you can additionally view the arguments.