Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odgovori
4654 Prikazi

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

Avatar
Opusti
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
Opusti
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
Opusti
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
Opusti
Avtor

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

Related Posts Odgovori Prikazi Aktivnost
1
dec. 24
3880
0
jun. 21
2014
2
maj 24
4805
2
jun. 22
4104
0
jun. 21
2191