Im ready to start pulling my hair out here. Trying to use jquery ajax request in Firefox to return simple string from method in my code behind. Regardless of what I try, I always get parsererror - unexpected character. I tried at least a dozen different variations based on demos Ive found online, none work.
 $.ajax({
                type: 'POST',
                url: '/Search/BasicSearch.aspx/sayHello',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                data: '{}',
                success: function (msg) {
                    alert(msg.d);
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    alert(textStatus + '  ' + errorThrown);
                }
            });
--code behind method
[WebMethod]
        public static string sayHello()
        {
            return "hello world";
        }
I have tried returning a properly formatted json string in this method, still didnt work.
EDIT: I forgot to mention that this site will is running on .NET 2.0. After unsuccessfully trying Will's suggestion below to set the response format to JSON, I thought I would try a plain 'ol generic handler and see what happens. Sure enough, it worked.
public class Handler1 : IHttpHandler {
public void ProcessRequest(HttpContext context)
{
    context.Response.ContentType = "application/json";
    context.Response.Write("{\"\": \"hello world\"}");
}
public bool IsReusable
{
    get
    {
        return false;
    }
}
}
So I am assuming its an underlying issue with .NET 2.0 aspx pages??? I think all of the examples I have seen were using at least 3.0.
 
     
     
     
    