$.post vs $.ajax throws invalid json primitive 'data'
WORKS NOT
$.post('Schoolyear/Create', { data: JSON.stringify({ schoolyearId: 1 }) });
throws exception internal server error 500: invalid json primitive 'data'
WORKS
$.ajax('Schoolyear/Create', { data: JSON.stringify({ schoolyearId: 1 }),
type: 'POST' });
Why can I not use the explicit $.post and have to write the type instead?
No comments:
Post a Comment