Skip to Content
Menu
This question has been flagged
3 Replies
5017 Rodiniai

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

Portretas
Atmesti
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.

Portretas
Atmesti
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

Portretas
Atmesti
Best Answer
var ajax = require('web.ajax');
var def = ajax.jsonRpc("/controller/route", 'call', {
... # your controller method parameters
});
return
$.when(def).then(function (vals) {
...
});


Portretas
Atmesti
Autorius

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

Related Posts Replies Rodiniai Veikla
1
gruod. 24
4097
0
birž. 21
2200
2
geg. 24
4983
2
birž. 22
4376
0
birž. 21
2381