JQuery / asp .net web service

Posted on 2009-12-26
Last Modified: 2012-05-08
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) {


                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) {



    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:="")> _

<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

Question by:doctor069
    1 Comment

    Accepted Solution

    Got it -

    Data has to be sent as a string

    var myDataSerialized = JSON.stringify(id);

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
    Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now