Hi everybody.
I want to return some kind of collection of objects when calling a Webservice from the Client
I saw a couple of tutorials and how to's how to return a complex type in this situation.
What i did not find is information how to pass a list of objects back to javascript.
i tried returning an array of string or a generic list of string, but then i can't process it on ClientSide.
Maybe i declare my callback function wrongly in javascript.
Does anybody have samples for this or any input?
Thanks! Martin
Hi Martin,
I'am returning some object arrays from server to JS, and processing this in client-side, here some pseudo:
Server Side:
[WebMethod]public MyObject[] GetMyObjectArray(){//...some fancy codereturn(myObjectArray);}Client-Side//The CallMyNameSpace.GetMyObjectArray(Process_OnComplete, onTimeout);function Process_OnComplete(result){for(var i=0; i < result.length; i++){
alert(result[i].MyObjectProperty);
}
}
hope this help
Hello kpeguero!
Thx a lot for your reply!
Seems i was just a victim of Caching.
But your sample helped me to be sure that i'm on the right way with my attempts. ;)
It works fine now wether i'm using arrays or generics... cool :)
Regards Martin
0 件のコメント:
コメントを投稿