[Zope] AJAX / HTML Fragment

SpiderX sp1d3rx at gmail.com
Mon Apr 21 14:17:51 EDT 2008


I'm writing my website to use AJAX for form posting and displaying content,
and instead of using AJAX to parse XML and then update the DOM, I'm using
Zope to create an HTML fragment and AJAX just writes it to the correct
location on the page. It works really great for what I'm doing, but the only
problem is that I get an error message:

"Error: no element found
Source File: http://myzopesite:8080/mywebsite/zz/NewNote
Line: 1"

NewNote is the location of the Python script which just posts the content to
a database (it actually execs a stored procedure)...
If I set the zsql query to "select 1 as true" at the end, that makes the
error go away. That leads me to believe something in the javascript is
wrong, so here's the relevant part of the javascript:

$.post('NewNote',{py_projectid: projectid,py_who: userName,py_note: note},
function()
           { // it saved. update display
           $('#theNotes').load('AJX_ListNotes?projectid='+ projectid);

       }

It is using jQuery, but I had it setup before as just a plain javascript,
but I still had the same problem. So, why would I get a "No element found"
on a POST query? Here is the content of the python script. It's as basic as
you can get:

        return container.addnote(projectid=py_projectid, who=py_who,
note=py_note)

That is the only thing which expect a return value. If I change that to
this:

       container.addnote(projectid=py_projectid, who=py_who, note=py_note)
       return 1

I don't get any error messages, but the "update display" never happens. So,
I'd like to have no error messages, and I'd also like not having to pollute
my zsql queries with stupid things like "select 1 as true". Any ideas on how
to accomplish that?

-- 
Thanks,
Derek Wilson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080421/73cf99af/attachment.htm


More information about the Zope mailing list