USING GET FOR AJAX CALLS GIVES ME 500 ERROR

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
 993  View(s)
Ratings:
Rate this:

I was calling a [web method] using POST but as I am 'getting' data back I am trying to use GET instead.

Using Post works. Using GET gives me a 500 error.

This is the main jquery call to my [web method]:

        $.ajax({

            type: 'GET',

            contentType: 'application/json',

            dataType: 'json',

            url: 'Cloud/Feed.aspx/GetNextFrames2',

            data: '{ test: "hime"}',

~

This is my test [web method].

[WebMethod]

[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]

public static string GetNextFrames2(string test)

{

    return 'test'

}

If I do not pass any parameters I will get no error using GET. As soon as add a parameter I get 500 internal error.

I have used wireshark and Fiddler but I cannot see anything useful.

This is obviously down to using parameters. So, at least I have pinpointed where the error is.

I have tried passing the parameters directly appended to the url:

myurl?par=testme...

but still same error.

What else can I try?

  1. Sumit Kesarwani

    Post:378

    Points:2694
    Re: using Get for ajax calls gives me 500 error

    Hi Ankit, 

    try this:

    $.ajax({

            type: 'GET',

            contentType: 'text/plain',

            dataType: 'json',

            url: 'Cloud/Feed.aspx/GetNextFrames2',

            data: '{ test: "hime"}',

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!