Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
3 Besvarelser
5149 Visninger

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

Avatar
Kassér
Bedste svar

$.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
Kassér
Bedste svar

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


Avatar
Kassér
Forfatter

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

Related Posts Besvarelser Visninger Aktivitet
1
dec. 24
4195
0
jun. 21
2287
2
maj 24
5070
2
jun. 22
4510
0
jun. 21
2479