I'm probably too late for this person, but if anyone else comes across this problem (like I just did) the answer is here:
https://groups.google.com/d/msg/web2py/kSUtyNcUQGI/Ta1VowPcJMgJ As I understand it getJSON() is just a wrapper for ajax(). If you use ajax(), you have a few more options including one called crossDomain, which should be set to true. For example: jQuery(document).ready(function ($) { //attach a jQuery live event to the button $('#submit-samples').click(function(){ $.ajax({ type: 'GET', url: "[url]", processData: true, data: {}, crossDomain: true, dataType: "json", success: function (data) { alert(data); } }); }); }); Next, if you add the following to your controller function: if request.env.http_origin: response.headers['Access-Control-Allow-Origin'] = 'http://www.[site].com' it will allow access from any site(s) you specify. Alternatively, you can set it to '*' to accept requests from any site. On Monday, 24 June 2013 22:22:36 UTC+1, Nam Soo In wrote: > > in controller > > > from gluon.tools import Service > service = Service() > > def call(): > session.forget() > return service() > > @service.json > def pullDataToMap(): > ...logic.. > return result > > result looks like this > {'San_Jose':102,'Paris':2,'London':38} > > I am trying to call that function in javascript > > so > <script> > $(document).ready(function(){ > console.log("hi") > $.getJSON(' > https://test.corp.nam.com/test/default/call/json/pullDataToMap', > function(data) { > console.log(data); > }); > > > }); > </script> > > > it seems like it is not calling HTTPRequest and I am not getting any data. > I am getting this error in console windows > XMLHttpRequest cannot load > https://test.corp.nam.com/test/default/call/json/pullDataToMap. Origin > null is not allowed by Access-Control-Allow-Origin. > > If I just put that url into the browser I can see the results > > Any thought? > Thank you in advance. > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

