Sorry, missing the link: http://prototypejs.org/api/ajax/options

--
david

On 11 fév, 22:23, david <david.brill...@gmail.com> wrote:
> Hi paul,
>
> not sending a response to the ajax call let it think it's not
> completed. I think the onException callback could help you in this
> case?? But not really sure.
> Let's have a glance to the list of accessible callback, because there
> is no reason that you'll never have to handle an error.
>
> --
> david
>
> On 11 fév, 20:49, Paul <pauljeffer...@gmail.com> wrote:
>
> > Just a quick edit:
> > I've jsut added a response to be sent back and got the alert to
> > display the response so that is fine, with the response tab in FireBug
> > showing:
> > This is a response    null;
> >  /* !eval(new String('(' + this.header('X-JSON');)) */    null;
> >  /* !eval(new String('(' + this.header('X-JSON');)) */
> > Thanks,
> > Paul
>
> > On Feb 11, 7:38 pm, Paul <pauljeffer...@gmail.com> wrote:
>
> > > Hi,
> > > Thanks for all your help so far.
> > > I've added the callback function so now have:
> > > <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") },
> > >             onComplete: function(response){alert(response)}
> > >         });
> > >     }});
>
> > >         Sortable.create('group2',{tag:'div',dropOnEmpty: true, 
> > > containment:
> > > sections,only:'lineitem',onUpdate:function(){alert(Sortable.serialize
> > > ("group2"))}});
> > >         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>
> > > with the response being [object XMLHttpRequest] although i haven't
> > > actually programmed the Python to send a response, as there's is
> > > nothing to send back, I'm only sending data to the server. (Just
> > > thought - it's not compulsory to send a response is it?)
> > > Using Firebug (btw - never seen it before but I like it:) ) it would
> > > appear that while a post request is being made if I click on the post
> > > tab it is just blank - does this mean that no data was sent?
> > > Under the header tab I just get standard infomation, and under the
> > > response tag I get:
> > > null;
> > >  /* !eval(new String('(' + this.header('X-JSON');)) */    null;
> > >  /* !eval(new String('(' + this.header('X-JSON');)) */
> > > In the javascript errors console I am getting a:
> > > Error: no element found
> > > Source File:http://127.0.0.1/
> > > Line: 1
> > > but am not sure if this is just due to me not sending a response.
> > > Sorry for a bit of a bitty post, and thankyou for your help so far,
> > > Paul
> > > P.S. What I am doing at the minute is essentially the 
> > > examplehttp://www.gregphoto.net/sortable/advanced/withtheAJAX added on top
> > > P.P.S - The 301 response is only sent to regular form requests not
> > > AJAX ones
>
> > > On Feb 11, 10:55 am, david <david.brill...@gmail.com> wrote:
>
> > > > Hi paul,
>
> > > > I can see at least one problem at the definition of the AJAX request.
> > > > You don't have any callback to treat the response.
> > > > You should have something like :
>
> > > >         new Ajax.Request("http://127.0.0.1/";, {
> > > >             method: "post",
> > > >             parameters: { data: Sortable.serialize("group1") },
> > > > !           onComplete:function(response){
> > > > !                  //Do what you need to do with the response
> > > > !           }
> > > >         });
>
> > > > I'm not a python coder, so I could say a bug mistake, but in the
> > > > python code, I see a "self.send_response(301) " and in that case, I
> > > > didn't know how AJAX request is handle?
>
> > > > To debug you're problem:
> > > > 1- verify in firebug (or else) what is the return of the AJAX.REQUEST
> > > > (text/json/...).
> > > > 2- If the 301 HTML code breaks the request, temporarly suppress it.
> > > > 3- Verify that the callback function in the ajax.request is called
> > > > (just fill this function with an alert).
>
> > > > I hope it help you, if the problem is still here after the change,
> > > > just update the post, I can see what I can do for you this evening
> > > > (french time).
>
> > > > --
> > > > david
>
> > > > On 11 fév, 11:00, "Alex Mcauley" <webmas...@thecarmarketplace.com>
> > > > wrote:
>
> > > > > use firefox and firebug and see whats getting posted in the console 
> > > > > log ..
> > > > > it should hell you to understand if Javascript is sending the data or 
> > > > > not
>
> > > > > ----- Original Message -----
> > > > > From: "Paul" <pauljeffer...@gmail.com>
> > > > > To: "Prototype & script.aculo.us" 
> > > > > <prototype-scriptaculous@googlegroups.com>
> > > > > Sent: Wednesday, February 11, 2009 12:53 AM
> > > > > Subject: [Proto-Scripty] AJAX
>
> > > > > > 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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to