Wednesday, March 28, 2012

Calling a web service from javascript at page load

I need to call a web service at page load from javascript. I have several other web services that are successfully called on other occasions (when leaving a text input field for example).

I suspect the reference by the script manager to the services aren't done at the moment of the call (when the page load). The service is working fine when called from another "event handler" i.e. whenever input events are fired. Also, any service I try to call at page load failed to be called.

So, do I guess right? What can I do to get my call to work?

I'm using April CTP

Thank you all in advance

Check thishttp://atlas.asp.net/docs/atlas/doc/services/exposing.aspx

look for Calling Web Services When a Page Loads, hope this helps.


Thank you very much... I should have look twice in the documentation

The documentation doesn't exist anymore, and the trick it suggested no longer works on Beta 2:

<scripttype="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<references>
</references>
<components>
<application id="application" load="OnApplicationLoad" />
</components>
</page>
</script>

What's an alternative way to do this besides using setTimeout to wait some arbitrary number of seconds before calling that javascript function "OnApplicationLoad"?

No comments:

Post a Comment