oh sorry, I removed the add_route and route_name from my last try, when I
added it back it works!!!  But I think the documentation is somewhat
unclear it is misleading:

1. it makes me think that the route is not needed
2. in the sample it is using sth like &callback=?



On Mon, Sep 9, 2013 at 12:17 AM, george hu <[email protected]> wrote:

> I've tried ?callback=?, got the same error, looks like the pyramid didn't
> match the request to the view callable
>
>
> On Sun, Sep 8, 2013 at 11:47 PM, Gael Pasgrimaud <[email protected]> wrote:
>
>> Hi,
>>
>> On Sun, Sep 08, 2013 at 11:28:49PM +0800, george hu wrote:
>> > Hello everyone, I can't figure out how to make jsonp request work, my
>> view
>> > callable is like this:
>> >
>> > @view_config(route_name="get_server_status", renderer='jsonp')
>> > def get_server_status(request):
>> >     return {"george":"hello"}
>> >
>> > and here is the lines in __init__.py:
>> >
>> > from pyramid.config import Configurator
>> > from pyramid.renderers import JSONP
>> >
>> > def main(global_config, **settings):
>> >     """ This function returns a Pyramid WSGI application.
>> >     """
>> >     config = Configurator(settings=settings)
>> >     config.add_static_view('static', 'static', cache_max_age=3600)
>> >     config.add_route('home','/')
>> >
>> >     config.add_renderer('jsonp', JSONP(param_name='callback'))
>> >     config.add_route('get_server_status', '/get_server_status*')
>> >
>> > and my javascript:
>> >
>> > <script>
>> > $(function() {
>> >     var serverAPI = "http://127.0.0.1:3456/get_server_status&callback=
>> ?";
>>
>> Should be:
>>
>>      var serverAPI = "http://127.0.0.1:3456/get_server_status?callback=
>> ?";
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pylons-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/pylons-discuss.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to