I'm issuing a PATCH request to my server in order to update a title:
$.ajax({
    url: Settings.get('serverURL') + 'Playlist/UpdateTitle',
    type: 'PATCH',
    dataType: 'json',
    data: {
        id: model.get('id'),
        title: title
    },
    success: function () {
        console.log("Success!");
    },
    error: function (error) {
        console.error("Failure!");
    }
});
[Route("UpdateTitle")]
[HttpPatch]
public IHttpActionResult UpdateTitle(PlaylistDto playlistDto)
{
    using (ITransaction transaction = Session.BeginTransaction())
    {
        PlaylistManager.UpdateTitle(playlistDto.Id, playlistDto.Title);
        transaction.Commit();
    }
    return Ok();
}
Everything works great except for the fact that the ajax request's error callback is executed and not the success callback.
Before Web API 2, I was using the following method which did not have the problem. Clearly the issue is that I am returning an Ok result instead of a JSON success object:
[HttpPost]
public JsonResult UpdateTitle(Guid playlistId, string title)
{
    using (ITransaction transaction = Session.BeginTransaction())
    {
        PlaylistManager.UpdateTitle(playlistId, title);
        transaction.Commit();
    }
    return Json(new
        {
            success = true
        });
}
What's the proper way to indicate success with web API 2?
 
     
    