webmethod help!

Discussion in 'General troubleshooting' started by Bizted, Mar 16, 2012.

  1. Hi, i'm a Junior .Net Developer!

    when I create a webmethod within the codebehind file for the page and I try to call it using PageMethods.SomeFunction() I get a javascript error on stating: PageMethods is undefined. What's going on? Am I possibly missing a line in my web.config file?

    everything works on my localhost!
     
  2. heres my javascript code:

    CallMe('http://rhealleb.w01.Winhost.com/Text/LaRecette01.txt');

    function CallMe(FileName) {
    PageMethods.GetLyrics(FileName, CallSuccess, CallFailed);
    }

    function CallSuccess(res) {
    if (res == null || res == "") {
    res = "Pas Disponnible";
    }

    $('#Song-Lyrics').append(res);
    }

    function CallFailed(res) {
    res = "Pas Disponnible";
    $('#Song-Lyrics').append(res);
    }


    and my code behind:

    [System.Web.Services.WebMethod]
    public static string GetLyrics(string fileName)
    {
    my code!
    }
     
    Last edited by a moderator: Oct 14, 2015

Share This Page