Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
3 Antworten
5185 Ansichten

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

Avatar
Verwerfen
Beste Antwort

$.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
Verwerfen
Beste Antwort

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
Verwerfen
Beste Antwort
var ajax = require('web.ajax');
var def = ajax.jsonRpc("/controller/route", 'call', {
... # your controller method parameters
});
return
$.when(def).then(function (vals) {
...
});


Avatar
Verwerfen
Autor

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

Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Dez. 24
4224
0
Juni 21
2293
2
Mai 24
5093
2
Juni 22
4526
0
Juni 21
2488