Skip to Content
Menu
This question has been flagged
3 Replies
4319 Views

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

Avatar
Discard
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
Discard
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
Discard
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
Discard
Author

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

Related Posts Replies Views Activity
1
Dec 24
3626
0
Jun 21
1764
2
May 24
4635
2
Jun 22
3788
0
Jun 21
1989