On Mac Os X with Apache personal web server.
The test HTML looks like this:

Foo.html -------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html>
    <head>
        <title>Demo Tag Cloud Model</title>
       <script type="text/javascript"
src="../../../scripts/MochiKit/MochiKit.js"></script>
        <script type="text/javascript" src="Chapter15.js" ></script>
    </head>
    <body>
        <h1>Tag Test</h1>
        <form name="Enter Stuff">
            <label>Enter something:</label>
            <input id="blah" name="user" value="lucid"/>
        </form>
        <a href="javascript:void(0)" onclick="DBQuery()">Click Me</a>
        <div id="HERE"/>
    </body>
</html>


---------------------------------------------------------------------

calls this Javascript:
Chapter15.js --------------------------------------------

var xmlHttpReq = false;
var gotMetadata = function (oData) {
    log("gotMetadata"+oData.responseText);
    var payload = evalJSONRequest( oData);
    replaceChildNodes( "HERE", P( null, payload.what));
};

var metadataFetchFailed = function (err) {
  alert( "The metadata for MochiKit.Async could not be fetched :"+err);
};

function DBQuery() {
    xmlHttpReq = getXMLHttpRequest()
    log("got xmlHttpReq ");
    xmlHttpReq.open( "POST", "Chapter15.py", true); // doesn't work
    //xmlHttpReq.open( "GET", "Chapter15.py", true); //
    log("got xmlHttpReq.open OK ");
    xmlHttpReq.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
    log("got xmlHttpReq.setRequestHeader OK ");
    var d = sendXMLHttpRequest( xmlHttpReq, "blah=" +
escape(getElement( "blah").value));
    d.addCallbacks(gotMetadata, metadataFetchFailed);
    log("got xmlHttpReq.sendXMLHttpRequest OK ");
}

---------------------------------------------------------------------


Which in turn invokes this python cgi script:
Chapter15.py-------------------------------------------


#!/usr/local/bin/python

import cgi

form = cgi.FieldStorage()
stuff = form.getfirst( "blah", "")


print """
{ "what": " %s" }
""" % stuff

---------------------------------------------------------------------
If I try a POST in Chapter15.js, then I get this series of log
messages:
INFO: got xmlHttpReq
INFO: got xmlHttpReq.open OK
INFO: got xmlHttpReq.setRequestHeader OK
INFO: got xmlHttpReq.sendXMLHttpRequest OK
INFO: The metadata for MochiKit.Async could not be fetched
:MochiKit.Async.XMLHttpRequestError("Request failed")

If I try a GET , then the log traces show:
INFO: got xmlHttpReq
INFO: got xmlHttpReq.open OK
INFO: got xmlHttpReq.setRequestHeader OK
INFO: got xmlHttpReq.sendXMLHttpRequest OK
INFO: gotMetadata ... has the content of Chapter15.py as the
oData.responseText, and hence nothing that looks like JSON for the
replaceChildNodes to work with

This may not be a  MochiKit problem at all, but rather an Apache config
problem, nonetheless I thought I would ask for a little "Crowd Wisdom"

Thanks in advance for any clues!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~----------~----~----~----~------~----~------~--~---

Reply via email to