Mochikit 㧠sendXMLHttpRequest ããéã« Content-Type ãè¨å®ããªãã¨ãCGI.pm 㧠URL ã¨ã³ã³ã¼ãããã POST ãã¼ã¿ãåãåããªã
ãµã¼ãã®å ¥ãæ¿ããè¡ãéã«ãæéãç¡é§ã«ããã®ã§ã¡ã¢ã
æ§ç°å¢ã§ã¯ãä¸è¨ã®ã³ã¼ãã§åé¡ãªãåä½ãã¦ããã®ã ãâ¦
// ..snip.. var r = getXMLHttpRequest(); r.open('POST', CGI_PATH, true); var args = formContents('form_id'); this.d = sendXMLHttpRequest(r, queryString(args[0], args[1])); this.d.addCallbacks( bind(this.call_back, this), bind(this.error_back, this) ); // ..snip..
æ°ç°å¢ã§ã¯ãCGI.pm ã new ãã㨠"POSTDATA" ã¨ãããã¼ã«ããã£ã¨ POST ãããã¼ã¿ãå
¥ã£ã¦ãã¾ãã
CGI.pm ã®ã³ã¼ããèªãã§ã¿ãã¨â¦
if ($meth eq 'POST' && defined($ENV{'CONTENT_TYPE'}) && $ENV{'CONTENT_TYPE'} !~ m|^application/x-www-form-urlencoded| && $ENV{'CONTENT_TYPE'} !~ m|^multipart/form-data| ) { my($param) = 'POSTDATA' ; $self->add_parameter($param) ; push (@{$self->{$param}},$query_string); undef $query_string ; }
ã©ãããã好ã㪠Parser ãæå®ã§ããããã«ããããã®æªç½®ãããã
"CGI.pm", "POSTDATA" ãªã©ã®ãã¼ã¯ã¼ãã§ã°ã°ãã¨ãå¤ãè¨äºã沢山å¼ã£ãããã®ã§ãç¸å½åããã®ä»æ§ãããâ¦ã
ã¨ããäºã§ãsetRequestHeader ã使ã£ã¦ "Content-Type" ãã¦ã¿ãã
// ..snip.. var r = getXMLHttpRequest(); r.open('POST', CGI_PATH, true); r.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); // ..snip..
FireFox ã®å ´åãopen ã®å㧠setRequestHeader ããã¨ã¨ã©ã¼ã¨ãªãã®ã§æ³¨æã
ãã£ã¨ä¸è¬ç㪠Perl Web ã¨ã³ã¸ãã¢ã®éã§ã¯å¸¸èãªãã ãããªã orz