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
On Mon, Apr 21, 2008 at 8:17 PM, SpiderX <sp1d3rx@gmail.com> wrote:
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"
Use Firefox and Firebug or LiveHTTPHeaders to see exactly what is going over the wire; you can also use command line tools like curl to recreate the request to debug what is going on on the zope and browser sides. Zope itself has very little to do with Javascript; once it serves the JS all the requests look the same to Zope regardless of how they were generated. -- Martijn Pieters
participants (2)
-
Martijn Pieters -
SpiderX