跳至內容
選單
此問題已被標幟
3 回覆
4989 瀏覽次數

it's any way to call http controller from js and also pass arguments?

頭像
捨棄
最佳答案

$.ajax({
url: "/your/controller",
data: data,
type: 'POST',
processData: false,
contentType: false,
success: function(result) {

//success code

}

});


Using type: 'POST' you can call http controller.

頭像
捨棄
最佳答案

Hi,

Please Refer the following blog to understand how to call http controller from js

https://www.cybrosys.com/blog/how-to-call-controller-method-from-javascript

Regards

頭像
捨棄
最佳答案
var ajax = require('web.ajax');
var def = ajax.jsonRpc("/controller/route", 'call', {
... # your controller method parameters
});
return
$.when(def).then(function (vals) {
...
});


頭像
捨棄
作者

No this only call json controller not http controller. Already tired not working and thanks for reply :)

相關帖文 回覆 瀏覽次數 活動
1
12月 24
4088
0
6月 21
2190
2
5月 24
4969
2
6月 22
4367
0
6月 21
2376