This should probably be done with dataFilter method http://api.jquery.com/jQuery.ajax/#callback-functions