Odoo Help

1

0
2 Answers
1
Avatar

Pawan

--Pawan--

1577
| 4 4 8
Hyderabad, India
--Pawan--


Pawan
19-04-16 08:28

Anand,

I too got this issue while making an ajax request to the controller.

Please try making

type:'POST',  in your .js ajax request

and in controller decorater it should be something like...

@http.route('/pproject/get_po_prices', methods=['POST'], type='json', auth="public", website=True)

then you can access your data using

data = request.jsonrequest

under yourcontroller

Hope it helps!    


1 Opmerking
Anand
19-04-16 09:37

Hi, @http.route('/web/webclient/version_info', type='json', auth="none") def version_info(self): return openerp.service.common.exp_version() This is the controller am calling.. This is Ajax call am using $(document).ready(function(){ $("button").click(function(){ $.ajax({url: "https://www.nomado.eu/web/webclient/version_info", success: function(result){ console.log(result); $("#div1").html(result); }}); }); }); But it gives me XMLHttpRequest cannot load https://www.nomado.eu/web/webclient/version_info. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '192.0.12.34' is therefore not allowed access. The response had HTTP status code 400. How to solve this.. please update

0
Avatar

Prakash

--Prakash--
webkul
1038
| 4 3 9
Pune, India
--Prakash--

I like to surround myself with brave, creative people.

My motivation for learning different technologies and algos drive me. I love challenges of a steep learning curve which I believe makes me a better learner. I have a strong desire to learn different technologies, which would enable me to become a full stack developer.

Prakash
19-04-16 07:51

the controller  @http.route('/web/webclient/version_info', type='json', auth="none")  you are calling have type='json', so just call it using jsonrpc, instead of http .

Please post the code you have done so far ,than only  we can help you.

1 Opmerking
Anand
19-04-16 09:38

Hi, @http.route('/web/webclient/version_info', type='json', auth="none") def version_info(self): return openerp.service.common.exp_version() This is the controller am calling.. This is Ajax call am using $(document).ready(function(){ $("button").click(function(){ $.ajax({url: "https://www.nomado.eu/web/webclient/version_info", success: function(result){ console.log(result); $("#div1").html(result); }}); }); }); But it gives me XMLHttpRequest cannot load https://www.nomado.eu/web/webclient/version_info. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '192.0.12.34' is therefore not allowed access. The response had HTTP status code 400. How to solve this.. please update

Stel een vraag
Writer
Keep Informed
1 volger(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now