Getting Error 500: Internal Server Error when I tried to called a web method from ajax in an aspx page

Getting Error 500: Internal Server Error when I tried to called a web method from ajax in an aspx page

Hi,

I created an Empty SharePoint 2010 project and with an aspx page.

I get the idea/code from the following link except I didn't use web service, but I put all the code in the .cs file.

http://aspdotnetcodebook.blogspot.ca/2009/11/cascading-dropdownlist-using-jquery-and.html

in the aspx: I have 

url: "mypage.aspx/GetStates",

where mypage.aspx is the name of the aspx page

instead of 

url: "WebService.asmx/GetStates",

Also below is top part of my aspx.cs page. And the rest is the same as the example from the link.

I wonder if I've missed anything. As I got the error: 500 Internal Server Error.

Please advice. Your help would be greatly appreciated!

using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Web.Services;
using System.Collections.Generic;

namespace CustomAppPage.Layouts.CustomAppPage
{
    public partial class mypage: LayoutsPageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }
        [WebMethod]
        public List<Cities> FindCityByID(string ID)
        {
            return GetCities().FindAll(x => x.StateId == int.Parse(ID));

        }