我正试图得到一个表单来排除odoo,所以我用websitebuilderhtml_form_builder构建了这个表单 通过该模块生成了html的代码 使用action属性生成的窗体
<form id="odoo_form" method="POST" action="http://localhost:8069/form/insert" enctype="multipart/form-data">
....
</form>
我用jquery代码扩展了html
$.ajax(my_form.attr('action'), {
data: postData,
processData: false,
contentType: false,
headers: {"Accept": "application/json" ,
},
success: function(data) {
//alert('response data = ' + data);
console.log('Success');
},
error: function (data) {
},
type: 'POST'});
当您调用jquery代码时 将调用控制器
@http.route('/form/insert', type="http", auth="public", csrf=False)
def my_insert(self, **kwargs):
return self.process_form(kwargs)
流程将按预期进行
if form_error:
return json.JSONEncoder().encode({'status': 'error', 'errors': return_errors})
我已经看到了函数调用并返回的日志/ 但是我在jquery中发现了这个错误
POST https://localhost:8069/form/insert net::ERR_FAILED
我已经通过编辑控制器函数解决了这个问题
相关问题 更多 >
编程相关推荐