Odoo Help

Welcome!

This community 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.

0

How to do Cross-Domain XML-RPC in Javascript

By
Ali Amjad
on 11/13/13, 10:00 AM 2,957 views

How can I use OpenERP 6.x's XML-RPC implementation via Javascript, I've tried many js libraries i.e.:

mimic-xmlrpc from sourceforge, timheap/jquery-xmlrpc from github

this is my code:

            var user = 'admin';
            var password = 'admin';
            var dbname = 'dbName';
            var authority = 'http://';
            var server = 'localhost';
            var port = '8069';
            var server_url = authority + server + port + '/xmlrpc/';

            var forcedUserValue = $.xmlrpc.force('string', user);
            var forcedPasswordValue = $.xmlrpc.force('string', password);
            var forcedDbNameValue = $.xmlrpc.force('string', dbname);

            $.xmlrpc({
                url: server_url + 'common',
                methodName: 'login',
                dataType: jsonp,
                params: [forcedDbNameValue, forcedUserValue, forcedPasswordValue],
                success: function(response, status, jqXHR) {
                     alert("Success!");
                },
                error: function(jqXHR, status, error) {
                     alert(jqXHR + '-' + status + '-' + error);
                }
            });

but I'm not getting any response?

0
Zahin
On 8/22/14, 7:01 AM

Utilize right XML-RPC Lib

http://goo.gl/rZP1Y6

 

-1
sharjeel ali shaukat
On 8/22/14, 6:24 AM

   var user = 'admin';
            var password = 'admin';
            var dbname = 'openerpdemo';
            var authority = 'http://';
            var server = 'odoo.knysys.com';
            var port = '8069';
            var server_url = authority + server + ':' + port + '/xmlrpc/';

            var forcedUserValue = $.xmlrpc.force('string', user);
            var forcedPasswordValue = $.xmlrpc.force('string', password);
            var forcedDbNameValue = $.xmlrpc.force('string', dbname);

            $.xmlrpc({
                url: server_url + 'common',
                methodName: 'login',
                dataType: 'jsonrpc',
                params: [forcedDbNameValue, forcedUserValue, forcedPasswordValue],
                success: function(response, status, jqXHR) {
                     // debugger;
      alert("response:"+response+"\n"+"status:"+status+"\n"+"jqXHR:"+jqXHR+"\n");
                },
                error: function(jqXHR, status, error) {
                     alert(jqXHR + '-' + status + '-' + error);
                }
            });

 

There was : missing in your code

and also run your program with brwser security here it is

for chrome in run use this

chrome.exe --disable-web-security

 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 11/13/13, 10:00 AM
Seen: 2957 times
Last updated: 3/16/15, 8:10 AM