Adam Yee schrieb:
> Hi all, I'm a newbie to MochiKit and JS, so bare with me if there are
> syntax errors or design flaws.
> 
> I'm trying to achieve simple AJAX functionality (using JSON) by
> submitting a single form input and displaying the input asynchronously
> with .innerHTML.
> 
> My code (testpage.html and controllers.py):
> http://dpaste.com/hold/56577/
> 
> The connect('form', 'onsubmit', submitClicked) doesn't seem to be
> doing anything.  The json.dumps(d) is doing its job - when submit is
> clicked, the page refreshes with only {"insert": "whatever text
> here"}.  I can't figure out how to json.loads properly, but if I can't
> get the JS to work, the the server side script won't receive any
> json.  So my struggle is in sending the xmlhttprequest.

Try attaching the onsubmit-action directly without the connect. And 
don't forget to return "false" from it, to prevent actual form-submission.

If that's helping, attach it using connect, and don't forget to call 
"stop()" on the passed event.

Also, use FireBug to see if your JS-functions are actually called.

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

Reply via email to