title: how to have a web.py python webservice return a jsonp call to jquery
body: <p><strong>So I'm trying to get a web.py based python webservice to send back a list object trough JSONP after jQuery makes an ajax call to it.</strong></p>
  
  <p>Problem is after reading up a lot of examples I'm still failing to understand how to make it work. Here's the code I got I'm working with atm:</p>
  
  <p>Javascript:</p>
  
  <pre><code>xmlrpcproxy = 'http://0.0.0.0:1885/'; //Back To The Future III reference on the port :)
  
  jQuery.ajaxSetup ({
      url: xmlrpcproxy, // &lt;--- returns valid json if accessed in the browser
      type: "GET",
      cache: false,
      contentType: "jsonp", // Pay attention to the dataType/contentType
      dataType: 'jsonp', // Pay attention to the dataType/contentType
      });
  jQuery.ajax({
      success: function(data) {
          console.log("You made it!");
      },
      error: function (xhr) {
          console.log("Error: " + xhr.statusText);
      }
  }).done(function(data){
      console.log(data);
      var firstoption = '&lt;option value="select" selected&gt;Please Select&lt;/option&gt;';
      jQuery("select#ItemIDSelect").html(firstoption);
      var i;
      var erplist = JSON.parse(data);
      jQuery("responsearea").append(erplist);
      for (i = 0; i &lt; erplist.length; ++i) {
                  jQuery("select#ItemIDSelect").append('&lt;option value="' + erplist[i] + '"&gt;' + erplist[i] + '&lt;/option&gt;');
      }
  });
  </code></pre>
  
  <p>Python web.py code</p>
  
  <pre><code>#!/usr/bin/python
  # _*_ encoding: utf-8 _*_
  
  import web
  import xmlrpclib
  import json
  
  urls = (
    '/(.+)', 'index',
  )
  
  
  class index:
      def GET(self):
      #THE FOLLOWING IS A SUCCESFULL QUERY FOR DATA TO AN ERP SERVER
      server = '***.***.*.**' #hidden the openerp server for stackoverflow post
      username = 'admin' #the user
      pwd = 'admin'      #the password of the user
      dbname = 'demo'    #the database
  
  
  
      # Get the uid
      sock_common = xmlrpclib.ServerProxy ('http://%s:8069/xmlrpc/common'%(server))
      uid = sock_common.login(dbname, username, pwd)
  
      #replace localhost with the address of the server
      sock = xmlrpclib.ServerProxy('http://%s:8069/xmlrpc/object'%(server))
  
      # Unactive all product with a stock = 0.0 and using the ancient code
  
      ids = sock.execute(dbname, uid, pwd, 'res.partner', 'search', [])
  
      p_ids = sock.execute(dbname, uid, pwd, 'res.partner', 'read', ids, ['name'])
      #END OF THAT PARTICULAR QUERY
  
      a=[]
      for p in p_ids:
          a.append(p['name'])
      b = json.dumps(a)
      return 'some_function(' + b + ')
  </code></pre>
  
  <p>example: typical content of <strong>b</strong></p>
  
  <pre><code>["The Jackson Group's Project", "Research &amp; Development", "E-Learning Integration", "Website Design Templates", "Data Import/Export Plugin", "1", "Project XXX", "Contract Agrolait", "Project : Agrolait"]
  </code></pre>
  
  <p>Can anyone help? As I understand there is a way of setting the name of the function in the javascript side so perhaps that would be one way to solve it, setting that to some_function I mean. But all idea's/ways as how to fix this are welcome ofc, so far nothing I tried worked >.&lt;</p>
  
  <p>Thanks for reading!</p>