how to make put / post calls with breeze js

自作多情 提交于 2019-12-11 07:54:17

问题


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.


回答1:


It's a good question!

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.



来源:https://stackoverflow.com/questions/18129539/how-to-make-put-post-calls-with-breeze-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!