Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parsererror with XmlHtpp-post-request



Hi Todd,

On 28.08.2006, at 18:54, Todd Ditchendorf wrote:

Are you running your widget on a Leopard developer seed or on Tiger?

No, I am not one of those fortunate ones :-)

req.open("POST", "http://www.example.com";);
req.setRequestHeader("Content-Type", "application/x-www-form- urlencoded");
req.send(postData);

If I understand right, this is the way it should be done in Tiger, right? And I did it exactly this way. Here's a snippet of what I wrote:


xmlhttp = false;
myUrl = "http:www.something.com";
myRequest = "Param1=" + myP1 + "&Param2=" + myP2 + "&Param3=" + myP3;
xmlhttp = new XMLHttpRequest();
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form- urlencoded");
xmlhttp.setRequestHeader("Content-length", myRequest.length );
xmlhttp.open('POST', myUrl, true);
xmlhttp.onreadystatechange=function(){
...
}


xmlhttp.send(myRequest);

See docs below for more XMLHttpRequest info:

http://developer.apple.com/internet/webcontent/xmlhttpreq.html

Speaking about this doc, I have to say that it seems quite incomplete to me, especially as a description of post-requests is missing. That should be updated by Apple, I would say.


I've tried it again and what I got back was the document,containing this text:

This page contains the following errors:
error on line 1 at column 1: Extra content at the end of the document
Below is a rendering of the page up to the first error.

Just to mention it, I also tried to setrequestheader with "application/xml" with the same result.

Greetings,

Stephan



On Aug 26, 2006, at 12:37 AM, Stephan Huebner wrote:

Hi,

it's most definitely no javascript-error as when I try to send out the post-request I get back a small html-document that contains just some ttags and a text saying something about a "parsererror". I almost believe it is an error-message generated by webkit or whatever it is that is responding to the request. Though I don't know what could have generated this error-message as I tried out a few post-request-examples from the internet and did exactly what they did for generating the request.

Greetings,

Stephan

On 25.08.2006, at 20:50, Russ White wrote:

what is giving you the parse error? javascript? or xmlhttprequest?

On Aug 25, 2006, at 9:24 AM, Stephan Huebner wrote:

Hi all,

I'm new to this list but not to widget-programming in general. And I'm from Germany, so my Englisch might sound a bit strange sometimes.

So, does anybody know why a post-request using XmlHttpRequest could result in a parsererror? Normal get-requests do work fine, but post-request do not though I think I did everything required including setting of headers for parameters like mime-type, length of data that will be sent with the post-request and so on. I am not sure if is a problem with the post-request itself or maybe with the url I use (maybe the result isn't well-formed or something so that might lead to an parsererror?

Btw, I get the same error if I disconnect the internet, so it rather seems as if this is an error-message built into safari or webkit, but even if, I still don't know what causes this error.

Greetings and thanks in advance,

Stephan Huebner

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/lists% 40russwhite.net


This email sent to email@hidden


-- Love: The only and satisfying answer to the existance of human being -- Sigmund Freud


_______________________________________________ Do not post admin requests to the list. They will be ignored. Dashboard-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden


-- Fanatiker tragen die Humorlosigkeit als Vereinsabzeichen - unbekannt



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden
References: 
 >parsererror with XmlHtpp-post-request (From: Stephan Huebner <email@hidden>)
 >Re: parsererror with XmlHtpp-post-request (From: Russ White <email@hidden>)
 >Re: parsererror with XmlHtpp-post-request (From: Stephan Huebner <email@hidden>)
 >Re: parsererror with XmlHtpp-post-request (From: Todd Ditchendorf <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.