1

I have created application page in SharePoint. In application page I have a WebMethod. I'm calling that web method using ajax call it works fine. Now I'm trying to pass parameter to web method, but this time it shows error My.aspx/GetData Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Please check below ajax call

`              $(document).on('click', '#btnSave', function () {
                debugger;
                var id = "";
                $("input:checked").each(function () {
                    id += $(this).attr("id") + ",";

                });

                var params = '{ID:' + id + '}';
                $.ajax({
                    type: "POST",
                    url: "MyApplications.aspx/GetData",
                    data: JSON.stringify(params),
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (response) {

                    },
                    failure: function (response) {
                        alert(response.d);
                    }
                });


            });`

Please check below c# method

[WebMethod]
public static string GetData(string ID)
{
string spURL = SPContext.Current.Web.Url;
 }

When I have pass parameter that time it will stop working.

please help me with this.

Error: Failed to load resource: the server responded with a status of 500 (Internal Server Error)

1
  • what if you try to use the full or server-relative URL instead of MyApplications.aspx/GetData? Jun 5 '17 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.