Can’t call server side function with jQuery (VB.net)

What am I doing wrong, here is my JS that fires on a button click

 $.ajax({ type: "POST" , url: window.location.href + "/clockIn" , data: "{lat:"" & latitude & "", lon:"" & longitude & ""}" , contentType: "application/json; charset=utf-8" , dataType: "json" , success: function (msg) { alert(msg); } }); 

And then this is my function server side

<System.Web.Services.WebMethod()> _ Public Shared Function clockIn(lat As String, lon As String) As String Return "foobar" End Function 

As you can see i’m literally just trying to output foobar at this point, but all i get is a 500 error in my js console.

submitted by /u/andrewsmd87
[link] [comments]

Leave a Reply