Perfect iTunes EQ settings

Dec 3rd ago

These are the perfect EQ settings for iTunes, give it a go

[?]
Share This

‘WebService’ is undefined Error: ASP.NET AJAX javscript call to a web service

Dec 3rd ago

Ok if you are like me and you are trying to call a webservice from javascript and you are getting the Web Service is undefined error then this will show you how to solve the problem. I wasted hours trying to figure this out, because all the tutorials and videos show them just adding the service ref to the proxy and it works like magic. The problem lies when you are using a web application project. Since web application projects use namespaces you need to add it before your call to the service. Also I needed to add using System.Web.Script.Services; and [ScriptService] to my asmx code behind. Below I will give an example of how to get this working.

Create your webservice. I added mine in a sub directory of my site named Services. So when looking into the code behind of the webservice you will see something like: namespace MyNamespace.Services you want to remember this. Next thing is to add: using System.Web.Script.Services; with the rest of the includes and also add the line: [ScriptService] just before the public class MyService : System.Web.Services.WebService

Next is to go to the aspx page and create the proxy.

<asp:scriptmanagerproxy id="“ScriptManagerProxy”" runat="“server”">
<services>
<asp:servicereference path="“~/Services/MyService.asmx”"></asp:servicereference>
</services>
</asp:scriptmanagerproxy>

Next comes the javascript

<script language="“javascript”" type="“text/javascript”">
function ButtonClick() { MyNamespace.Services.MyService.MyFunction(OnComplete) }
function OnComplete(results) { alert (results) }
</script>

Notice the “MyNamespace.Services.” before the name of the webservice. This is important to add when using a web application project, it is not need when making a regular web site because a web site does not use namespaces. So there you go, you should now be able to get things up and running.

[?]
Share This

  • I'm currently

  • Contact Me via Skype

    Skype Me!
    Skype Me!

     

    November 2008
    M T W T F S S
    « Dec    
     12
    3456789
    10111213141516
    17181920212223
    24252627282930

    Categories

     

      Baby 625aeroparque_22-05-20050054Perfect ViewDSC00933SDC10285DSC06134IMGP1368

    About

    I am a boy and this is my life feed.


    Close
    E-mail It