如何使放/ POST调用与微风JS [英] how to make put / post calls with breeze js
问题描述
你怎么能这样就把/后调用,而不是使用JS清风在使用entityManager.saveChanges?
how can you do put / post calls instead of using entityManager.saveChanges when using breeze js?
我基本上有一个没有被跟踪只读实体,但我需要调用,将采取一个或两个参数,并执行一些操作的服务方法。
I basically have a readonly entity that is not being tracked but I need to call a service method that will take a parameter or two and will perform some action.
推荐答案
这是一个很好的问题!
It's a good question!
现在你最好的选择是绕过Breeze.saveChanges方法,简单地直接使用微风的Ajax适配器。事情是这样的:
For now your best bet would be to bypass the Breeze.saveChanges method and simply use Breeze's ajax adapter directly. Something like this:
ajaxImpl = breeze.config.getAdapterInstance("ajax");
ajaxImpl.ajax({
type: "POST",
url: "some.url",
data: { name: "John", location: "Boston" }
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});
我们做打算为此提供一个更清洁的包装在未来几年版本之一,但我们仍在努力想出正确的设计。
We do plan to provide a cleaner wrapper for this in one of the next few versions, but we are still trying to come up with the right design.
这篇关于如何使放/ POST调用与微风JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!