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=?";;
    function getupd() {
        $.getJSON(serverAPI, function(data) {
             $.each(data, function (key, val) {
                alert('Hello');
            });
              });
            }

        $('#pp').click(function () {
        getupd();
        });

 ......


In the chrome debug I saw the request:

   1.
   
http://127.0.0.1:3456/get_server_status&callback=jQuery19101569586533587426_1378653472112?_=1378653472113



but the response is always 404 not found.

I have done research in the document and googled around, I can't see a
working example/demo of using jsonp. Could somebody give me a hint on this
issue?

Thanks a lot!



   1.

-- 
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