Getting 500 Internal Server Error when calling a WebMethod using ajax
<p>I am having an issue hitting my C# WebMethod on the code behind and getting 500 internal server error. I don't really understand why it won't hit it so it would be really great if someone could tell me what is the problem.</p>

<p><a href="https://i.stack.imgur.com/xdZYm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xdZYm.png" alt="enter image description here"></a></p>

<p>So this is my ajax call and doesn't work even with data and datatype not commented out.</p>

<pre><code>$('#chkBxAutoCost')
    .click(function(e) {
            $.ajax({
                type: "POST",
                url:   "BatchReportCriteriaSelection.aspx/GetAutoJsonBatches",
                contentType: 'application/json; charset=utf-8',
                dataType: 'json',
                data: "{}",
                error: function(XMLHttpRequest, textStatus,    errorThrown) {
                    console.log("Request: " +
                        XMLHttpRequest.toString() +
                        "\n\nStatus: " +
                        textStatus +
                        "\n\nError: " +
                        errorThrown);
                },
                success: function() { console.log("success") }
            });
        }
    );
</code></pre>

<p>And this is my code behind method of the page:</p>

<pre><code>[WebMethod]
public string GetAutoJsonBatches()
{
    return autoJsonBatches;
}
</code></pre>

<p>So I have attached a breakpoint on this WebMethod and it's not being hit. I am pretty stuck so if someone had any insight I'd greatly appreciate it.</p>