On Wednesday 21 January 2009 11:58:57 Boštjan Jerko wrote: > Hello! > > I'd like to change a MySQL filed when user clicks link. > My idea is to use javascript's onClick and loadJSONDoc in javascript > to pass all the relevant data. But at the end I am not even sure if I > use loadJSONDoc correctly since when I test it it doesn't work as > expected. > > Here is what I have in kid template: > > <a href="http://www.turbogears.org" onClick="yell()" > target="_blank">Official website</a> > > and here is alert.js (which is included in master.kid: > > function yell() > { > var d=MochiKit.Async.loadJSONDoc("http://www.google.com"); > } > > > Can anybody point me to the right direction?
Please read the documentation in MochiKit about asynchronous programming. You need to set a callback on the deferred. Also, what do you expect to happen if you query google for json output? AFAIK you can't make requests to urls other than the system the page is loaded from (at least that's what happens for me if I trie that) You need of course a json-delivering function in *your* application, and query that. And I consider you read http://www.catb.org/~esr/faqs/smart-questions.html This is not meant as insult - but as glad as we are helping newbies (or anybody), this list is not supposed to play "twenty questions" with them. You need to provide more details. "Does not work" isn't insightful. We know that already, otherwise you wouldn't ask, wouldn't you? Diez --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

