Hi,
I'm fairly new to AJAX, and I'm trying to send it to my Python server
for the project that I'm doing, after doing a Sortable.serialize, but
I'm getting no data at the other end - the problem being I'm not sure
if it is the Python or the javascript which is causing the problem, so
I was wondering if people would be able to check my javascript?
I've got:
<SCRIPT type="text/javascript">
        // <![CDATA[
        Sortable.create('group1',{tag:'div',dropOnEmpty: true, containment:
sections,only:'lineitem',onUpdate:function() {
        new Ajax.Request("http://127.0.0.1/";, {
            method: "post",
            parameters: { data: Sortable.serialize("group1") }
        });
    }
});
        Sortable.create('group2',{tag:'div',dropOnEmpty: true, containment:
sections,only:'lineitem',onUpdate:function(){alert('change2')}});
        Sortable.create('group3',{tag:'div',dropOnEmpty: true, containment:
sections,only:'lineitem',onUpdate:function(){alert('change3')}});
        Sortable.create('page',{tag:'div',only:'section',handle:'handle'});
        // ]]>
  </SCRIPT>
The Sortable.serialize("group1") works when I put it as an alert so I
can rule that out so I can only think that I've constructed the AJAX
request wrong, but can't see how - I can see the POST going to the
server and can see an object appearing, but as far as I can tell it's
empty. If anyone's interested the Python code is:
    def do_POST(self):
            global rootnode
            ctype, pdict = cgi.parse_header(self.headers.getheader
('content-type'))
            if ctype == 'multipart/form-data':
                query=cgi.parse_multipart(self.rfile, pdict)
                print(cgi.parse_header(self.headers.getheader('content-
type')))

                self.send_response(301)

                self.end_headers()
                print(query.get('data'))
                h = codecs.open ("log.txt", "a", encoding="utf8")
                h.write("test")
                h.close()


                print(query.get('random'))
                self.wfile.write(query.get('random'));

            elif ctype == 'application/x-www-form-urlencoded':
                print(cgi.parse_header(self.headers.getheader('content-
type')))
                data = self.rfile
                print(data.data)
Thank you for any help, I really appreciate it as I am totally stumped
Paul

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to