Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
3 Replies
4516 Tampilan

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

Avatar
Buang
Jawaban Terbai

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

Avatar
Buang
Jawaban Terbai

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

Avatar
Buang
Jawaban Terbai
var ajax = require('web.ajax');
var def = ajax.jsonRpc("/controller/route", 'call', {
... # your controller method parameters
});
return
$.when(def).then(function (vals) {
...
});


Avatar
Buang
Penulis

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

Post Terkait Replies Tampilan Aktivitas
1
Des 24
3799
0
Jun 21
1894
2
Mei 24
4742
2
Jun 22
3958
0
Jun 21
2070