Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odpovědi
4973 Zobrazení

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

Avatar
Zrušit
Nejlepší odpověď

$.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
Zrušit
Nejlepší odpověď

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
Zrušit
Nejlepší odpověď
var ajax = require('web.ajax');
var def = ajax.jsonRpc("/controller/route", 'call', {
... # your controller method parameters
});
return
$.when(def).then(function (vals) {
...
});


Avatar
Zrušit
Autor

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

Related Posts Odpovědi Zobrazení Aktivita
1
pro 24
4075
0
čvn 21
2187
2
kvě 24
4968
2
čvn 22
4361
0
čvn 21
2375