Does anyone know how to create a new "cookbook" on the web.py site? What I'm about to say is the sort of thing I wish I'd had 12 weeks ago.
jQuery is a javascript "helper" framework that has changed my life in web development. My application is 100% static html pages, with jquery ajax webmethods being served by web.py. I don't use templating except so I can have a sort of "master" page header and footer. The rest is pure ajax client/rest server. Attached are two files that demonstrate doing jQuery ajax from a web.py server. I've included jquery from google code to make the example work - if you like you can include jquery locally in your directory with your other script. Put the index.html file in the /static directory, and then run main.py. I'll put this all in a cookbook if someone will guide me how. S On Tue, Jun 19, 2012 at 3:39 PM, Tomas Schertel <[email protected]> wrote: > Do you have an working example using jquery + webpy? > > Thanks. > > > On Tuesday, 19 June 2012 15:33:54 UTC-3, NSC wrote: >> >> I don't think it's gonna be possible without javascript. The onchange >> event of a select element *is* javascript as you know. >> >> In my experience it's most efficient to use jQuery, bind an ajax call to >> the change event, and update/display the second box in the callback. >> That's the "web2.0" way. Upside - no page refreshes. Downside - pretty >> robust client side code. >> >> If you're feeling more oldschool (php/asp'ish), you could with minimal >> javascript have the onchange event simply post the entire form, and on the >> server look at the posted fields and determine what to deliver back. >> Upside - minimal client javascript. Downside - full page roundtrips on >> field changes are a suboptimal user experience, they tend to annoy users >> and mess with the browser history. >> >> A third option (I almost didn't even mention because it's exactly the >> opposite of your original question) is to populate the initial page with >> all the data you need for every combination, then do your user experience >> completely in javascript. If it's not a ton of data this is easy and >> efficient, and pretty dang safe now that all modern browsers are basically >> "pitfall free". >> >> It really depends on which method will best fit the rest of your >> application. >> >> If you avoid javascript because it's annoying, I totally agree - it is. >> But jQuery changed my life, and if you're not familiar with it the payoff >> is well worth the learning curve. >> >> S >> >> On Tue, Jun 19, 2012 at 11:57 AM, Tomas Schertel <[email protected]>wrote: >> >>> Is there a way to create dynamic dropdowns without javascript? >>> I though some thing like call a python/webpy function on onchange event >>> to populate a second dropdown, >>> Has someone tested/tried it? >>> >>> Thanks. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "web.py" group. >>> To view this discussion on the web visit https://groups.google.com/d/** >>> msg/webpy/-/9Rha76ONtYIJ<https://groups.google.com/d/msg/webpy/-/9Rha76ONtYIJ> >>> . >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to webpy+unsubscribe@** >>> googlegroups.com <webpy%[email protected]>. >>> For more options, visit this group at http://groups.google.com/** >>> group/webpy?hl=en <http://groups.google.com/group/webpy?hl=en>. >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "web.py" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/webpy/-/GdgtUhH8v9EJ. > > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/webpy?hl=en. > -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.--Pick One-- Canada USA
main.py
Description: Binary data
