Skip to Content
Menú
This question has been flagged
3 Respostes
4689 Vistes

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

Avatar
Descartar
Best Answer

$.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
Descartar
Best Answer

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


Avatar
Descartar
Autor

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

Related Posts Respostes Vistes Activitat
1
de des. 24
3898
0
de juny 21
2045
2
de maig 24
4837
2
de juny 22
4165
0
de juny 21
2220