Re: Simple Jquery AJAX question

2011-06-16 Thread AwaisMuzaffar
Thanks for the reply. It has been very helpful. Regards, Awais On Jun 16, 4:47 pm, Michael Merickel wrote: > On Thu, Jun 16, 2011 at 10:03 AM, AwaisMuzaffar > wrote: > > >    config.add_route('ajax', '/ajax/', view='testproject.views.ajax') > > >    def ajax(request): > >        string = 'hello

Re: Simple Jquery AJAX question

2011-06-16 Thread Michael Merickel
On Thu, Jun 16, 2011 at 10:03 AM, AwaisMuzaffar wrote: >config.add_route('ajax', '/ajax/', view='testproject.views.ajax') > >def ajax(request): >string = 'hello world' >return Response(string) > This is fine, but there are 2 enhancements you may want to use in your Pyramid

Re: Simple Jquery AJAX question

2011-06-16 Thread AwaisMuzaffar
Thank you for the reply. I am using url_dispatch. I have done as follows: In the init.py: I have added: config.add_route('ajax', '/ajax/', view='testproject.views.ajax') In the views.py: def ajax(request): string = 'hello world' return Response(string) and my jquery c

Re: Simple Jquery AJAX question

2011-06-16 Thread Robert Jackiewicz
Hi AwaisMuzaffar, 1. To be able to call a python function via an ajax call you will have to make the function in your python module a callable view and then call the url that is assigned to the view in your js script. 2. As for calling a view in $.post, are you using traversal or url_dispatch?

Simple Jquery AJAX question

2011-06-16 Thread AwaisMuzaffar
1- In my pyramid package directory, if I create a file called somefunction.py and I want to call this function using $.post, what URL would I specify to call this function. and: 2- And if I have a view function called aview created in views.py, can I call this function by simply referring the $.p