Home > DeveloperSection > Forums > using Get for ajax calls gives me 500 error
Ankit Singh

Total Post:341

Points:2389
Posted on    September-02-2014 11:40 PM

 ASP.Net ASP.Net 
Ratings:


 1 Reply(s)
 668  View(s)
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?



Sumit Kesarwani

Total Post:378

Points:2694
Supported
Posted on    September-03-2014 11:24 PM

Hi Ankit, 
try this:

$.ajax({

        type: 'GET',

        contentType: 'text/plain',

        dataType: 'json',

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

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


Don't want to miss updates? Please click the below button!

Follow MindStick