page method question
<p>I'm building an asp.net page that uses a page method call from jquery. This is a simple test page but I can't get it to work and I can't see why.</p>

<p>I added a script manager to the aspx. Here's the javascript function:</p>

<pre><code>&lt;script type="text/javascript"&gt;

    function CallGetLoaded() {

        var ConfirmLoad = "test string";

        $.ajax({
            type: "POST",
            url: "../Pages/TestPage.aspx/GetLoaded",
            data: ConfirmLoad,
            contentType: "application/text; charset=utf-8",
            dataType: "text",
            success: successLoadLeads,
            error: errorLoadLeads
        });

    };

    function successLoadLeads(thereturn) { alert((thereturn)); };
    function errorLoadLeads() { alert("problem getting return"); };

&lt;/script&gt;
</code></pre>

<p>And here's the full code behind:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Script.Serialization;
using System.Web.Services;

public partial class Pages_TestPage : System.Web.UI.Page
{

    [WebMethod]
    public static string GetLoaded(string ConfirmLoad)
    {

        string ResultString = "got test";

        return ResultString;
    }
}
</code></pre>

<p>Instead of getting back a simple string in the alert popup, I'm sometimes getting back the HTML of the whole page and sometimes the error function; not sure why it varies.
What am I missing?</p>

<p>Thanks for your suggestions.</p>
