- My project namespace is ajaxTest
- My webservice class is helloTest
- My webservice function is helloWorld
I enabled the web service using the [System.Web.Script.Services.ScriptService()] attribute
I put the script manager code block in place and included a reference to the service.
<asp:ScriptManager ID=”ScriptManager1″ runat=”server”>
<asp:ServiceReference Path=”helloTest.asmx” />
var tmp = helloTest.helloWorld(onResult, onTimeout, onError);
It was at this point I received the “helloTest is undefined” message.
A quick search on google revealed two websites which helped me.Â The first had the right answer (in my situation).Â Strangely, the second website had a slightly different solution which seems to have helped a number of people, but I was unable to figure out why (I didn’t work for me).
So, the solution that worked:
Namespace.Class.Function >> ajaxTest.helloTest.helloWorld
The solution which didn’t work for me but has worked for others is to use the following structure:
Namespace.Services.Class.Function >> ajaxTest.Services.helloTest.helloWorld
No idea why the difference, but hey.