mardi 14 juillet 2015

ajax call is never post back to the server

I am trying to make an ajax call back to the server to save the new data into the database: here is my code:

$.ajax({
    type: 'POST',
    url: '@Url.Action("SaveNewApplication")',
    contentType: 'application/json; charset=utf-8',
    data: {
        appName: newAppName,
        appDesc: newAppDesc,
        expire: newDaysToExpire,
        displayNote: newDspNote,
        adminRole: newAdminRole,
        defualtRole: newDefaultRole,
        active: newIsActive
    },
    dataType: '',
    success: function () {
        alert("new data has been saved");
    },
    error: function () {
        alert("Error happened whiles saving the new application data");
    }
});

I set a break point at the "SaveNewApplication" function but the break point is never hit! here is the "SaveNewApplication" function:

    [HttpPost]
    [OutputCache(Duration = 0)]
    public void SaveNewApplication(string appName, string appDesc, int expire, string displayNote, string adminRole,
       string defualtRole, bool active)
    {

    }

the success function in the ajax call is never executed

Aucun commentaire:

Enregistrer un commentaire