Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
5010 มุมมอง

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 :)

Related Posts ตอบกลับ มุมมอง กิจกรรม
Get host address or domain แก้ไขแล้ว
1
ธ.ค. 24
4096
0
มิ.ย. 21
2195
2
พ.ค. 24
4975
2
มิ.ย. 22
4374
0
มิ.ย. 21
2379