Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3 Antwoorden
5129 Weergaven

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

Avatar
Annuleer
Beste antwoord

$.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
Annuleer
Beste antwoord

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


Avatar
Annuleer
Auteur

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

Gerelateerde posts Antwoorden Weergaven Activiteit
1
dec. 24
4185
0
jun. 21
2273
2
mei 24
5058
2
jun. 22
4485
0
jun. 21
2469