JQuery / asp .net web service

Hi- I am trying to implement a web service with Jquery

Below is my code:

All i want it to do is post the data and return the "Hello World"

I keep getting a 500 Internal Server Error...

Just looking to do a simple Post

Any help would be appreciated (p.s. I'm using 2.0 framework - if that matters)
function removeImage(id) {
                $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "ProductPhotoDelete.asmx/HelloWorld",
                data: { a: 1, b: "test" },  
                dataType: "json",
                success: AjaxSucceeded,
                error: AjaxFailed
            }); 
    }

 function AjaxSucceeded(result) {
        alert(result.d);
    }

    function AjaxFailed(result) {
        alert(result.status + ' ' + result.statusText);
    }  

'----------------------------------------------------------------------------------

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class ProductPhotoDelete
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function HelloWorld(ByVal a As Integer, ByVal b As String) As String
        Return "Hello World"
    End Function

    <WebMethod()> _
     Public Function HelloToYou(ByVal name As String) As String
        Return "Hello " + name
    End Function

Open in new window

doctor069Asked:
Who is Participating?
 
doctor069Connect With a Mentor Author Commented:
Got it -

Data has to be sent as a string

var myDataSerialized = JSON.stringify(id);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.