Page Methods return undefined javascript error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?RnJlc25vIEJvYg==?=

    #1

    Page Methods return undefined javascript error

    I have a web method in my page, with Page Methods enabled on
    ScriptManager. When I call the function to get a return value my alert box
    says undefined. It works if I define a OnSuccess function in JS for my
    method. I want to get a return value and feed it to another JS function. I am
    quite happy for the calls to be synchronous as one JS function needs a
    function from a previous one. This is VS 2008 SP 1 and .net 3.5

    <WebMethod()_
    Public Shared Function MyMethod(ByVal name As String) As String
    Return "Hello " & name
    End Function


    <asp:ScriptMana ger ID="ScriptManag er1" runat="server"
    EnablePartialRe ndering="true" EnablePageMetho ds="True">
    </asp:ScriptManag er>



    window.onload = function() {

    alert(PageMetho ds.MyMethod("Pa ul Hayman"));

    }
Working...