本文介绍了在淘汰赛js中的MVC Web API中的post方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我需要使用Knockout js在MVC web API上发布post,delete,put方法的示例和示例。我在MVC web API中运行Post方法时出错了。请尽快给出解决方案。



这里我的帖子方法代码:



 $ .ajax({
url:'api / product / PostProduct /',
cache:false,
type:'POST',
contentType:'application / json; charset = utf-8',
数据:ko.toJSON(产品),
成功:函数(数据){
alert('added');
self.Products.push (数据);
self.BrandName();
self.price();
self.GenericName();
}
} ).fail(
函数(xhr,textStatus,err){
alert('error');
});
解决方案



Hi,

i need samples and examples for post,delete,put method on MVC web API with Knockout js. i got an error while running Post method in MVC web API. pls give solution ASAP.

here my code for Post Method:

$.ajax({
                       url: 'api/product/PostProduct/',
                       cache: false,
                       type: 'POST',
                       contentType: 'application/json; charset=utf-8',
                       data: ko.toJSON(Product),
                       success: function (data) {
                            alert('added');
                           self.Products.push(data);
                           self.BrandName("");
                           self.price("");
                           self.GenericName("");
                       }
                   }).fail(
                        function (xhr, textStatus, err) {
                            alert('error');
                        });
解决方案



这篇关于在淘汰赛js中的MVC Web API中的post方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 03:22