Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
5058 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

$.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.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất
var ajax = require('web.ajax');
var def = ajax.jsonRpc("/controller/route", 'call', {
... # your controller method parameters
});
return
$.when(def).then(function (vals) {
...
});


Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 12 24
4129
0
thg 6 21
2230
2
thg 5 24
5007
2
thg 6 22
4417
0
thg 6 21
2430