Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
4879 Vistas

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

Avatar
Descartar
Mejor respuesta

$.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
Descartar
Mejor respuesta

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


Avatar
Descartar
Autor

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

Publicaciones relacionadas Respuestas Vistas Actividad
1
dic 24
4023
0
jun 21
2162
2
may 24
4939
2
jun 22
4298
0
jun 21
2349