1

I have a meeting table data and i am using it to send to server side page check my url and tell me why call is not sucessfull even data is passed correctly here is my ajax call

    $.ajax({
             type: 'POST',
             contentType: "application/json; charset=utf-8",
             url: 'AddNewMeeting.aspx/SaveMeetingShechudar',
             dataType: 'json',
             data: JSON.stringify(Meeting),
             success: function (response) {
                 alert("success ");
             },
             error: function (jqXHR, textStatus, errorThrown)   //what to do if fails
             {
                 //  alert('bad, ' + errorThrown + ", " + jqXHR.responseText + ", " + textStatus);
                 alert("success failed ");

             },
         });

here is my code of AddNewMeeting.aspx file

  public static void SaveMeetingShechudar(string MDate, string MTime, int MPurpose, int masterID, int RowNumber, string[] name, string[] nic, string[] designation, string[] company, string[] address)
    {
        int mID = 0;
        try
        {

            #region master part save
            MeetingSchedulMaster master = new MeetingSchedulMaster();
            master.m_date = Convert.ToDateTime(MDate);
            master.m_datetime = MTime;
            master.m_host = UserID;
            master.m_puposeid = Convert.ToInt32(MPurpose);
            master.m_entry_date = DateTime.Now;

            if (masterID == 0)
                saveDataMaster(master);
            else
            {
                master.mid = masterID;
                UpdateData(master);

            }
            #endregion
            #region detail part save
            if (MasterIDForUpdation == 0)
                mID = GetMaxMeetinNumber_ID("2");
            else
                mID = masterID;

            for (int i = 1; i <= RowNumber; i++)
            {
                MeetingSchedulDetail detail = new MeetingSchedulDetail();
                //TableRow row = tbladdnewmeeting.Rows[i-1];
                detail.name = name[i];
                detail.cnic = nic[i];
                detail.designation = designation[i];
                detail.company = company[i];
                detail.address = address[i];
                detail.mid = mID;
                saveDataDetail(detail);


            }

        }
        catch (Exception e) { }

  }

error http://localhost:57927/forms/AddNewMeeting.aspx/SaveMeetingShechudar 500 (Internal Server Error)

1
  • Internal server error means something is not right on the server side code Commented Aug 2, 2015 at 9:28

1 Answer 1

2

Try adding the [WebMethod] attribute.Which is in the System.Web.Services namespace:

**[WebMethod]**
public static void SaveMeetingShechudar(string MDate, string MTime, int MPurpose, int masterID, int RowNumber, string[] name, string[] nic, string[] designation, string[] company, string[] address)
{
    int mID = 0;
     try
        {

        #region master part save
        MeetingSchedulMaster master = new MeetingSchedulMaster();
        master.m_date = Convert.ToDateTime(MDate);
        master.m_datetime = MTime;
        master.m_host = UserID;
        master.m_puposeid = Convert.ToInt32(MPurpose);
        master.m_entry_date = DateTime.Now;

        if (masterID == 0)
            saveDataMaster(master);
        else
        {
            master.mid = masterID;
            UpdateData(master);

        }
        #endregion
        #region detail part save
        if (MasterIDForUpdation == 0)
            mID = GetMaxMeetinNumber_ID("2");
        else
            mID = masterID;

        for (int i = 1; i <= RowNumber; i++)
        {
            MeetingSchedulDetail detail = new MeetingSchedulDetail();
            //TableRow row = tbladdnewmeeting.Rows[i-1];
            detail.name = name[i];
            detail.cnic = nic[i];
            detail.designation = designation[i];
            detail.company = company[i];
            detail.address = address[i];
            detail.mid = mID;
            saveDataDetail(detail);


        }

    }
    catch (Exception e) { }

}

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.