تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
4328 أدوات العرض

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

الصورة الرمزية
إهمال
أفضل إجابة

$.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.

الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال
أفضل إجابة
var ajax = require('web.ajax');
var def = ajax.jsonRpc("/controller/route", 'call', {
... # your controller method parameters
});
return
$.when(def).then(function (vals) {
...
});


الصورة الرمزية
إهمال
الكاتب

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

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
ديسمبر 24
3629
0
يونيو 21
1768
2
مايو 24
4638
2
يونيو 22
3793
0
يونيو 21
1990