function postProduct() { var product = { Name: "SampleProduct", Category: "TestCategory", Price: 10.99 }; $.ajax({ type: 'POST', data: JSON.stringify(product), url: "/api/products", contentType: "application/json" }).done(function (data) { var message = data.Name + ' $:' + data.Price; alert(message); }); }
مطالعه بیشتر