[jQuery] Submitting form via AJAX
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Verdana color=#0000ff size=2><SPAN
class=234131116-12072006>Are you serving the .phtml page with content-type:
text/xml? If not, you're getting it as plain text and the code won't
work.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Verdana color=#0000ff size=2><SPAN
class=234131116-12072006></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Verdana color=#0000ff size=2><SPAN
class=234131116-12072006>Set a breakpoint on the first line of success() and see
what the actual value of the xml variable is, plain text or a DOM node. Or use
alert(xml). If the alert shows you the actual XML code, then you
are receiving it as plain text and not parseable XML. It should
display [Object XMLSomethingOrOther].</SPAN></FONT></DIV><FONT face=Verdana
color=#0000ff size=2></FONT><FONT face=Verdana color=#0000ff size=2></FONT><FONT
face=Verdana color=#0000ff size=2></FONT><FONT face=Verdana color=#0000ff
size=2></FONT><FONT face=Verdana color=#0000ff size=2></FONT><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><SPAN
class=188252715-12072006><FONT face=Arial size=2>I'm trying to make this
call</FONT></DIV>
<DIV><PRE class=wiki> $.ajax({<BR> url: "/ajax/ajax_process.phtml",<BR> type: "POST",<BR> data: $.param( $("#form").formdata() ),</PRE><PRE class=wiki> success: function(xml) {<BR> alert ( $("response", xml).text() );<BR> },<BR> error: function() {<BR> alert ("KO");<BR> }<BR> });</PRE><PRE class=wiki><FONT face=Arial size=2>But I cannot access the xml contents.</FONT></PRE></SPAN></DIV></BLOCKQUOTE>
<STYLE>A.special_link {
COLOR: #4e81c4; TEXT-DECORATION: none
}
A:hover {
TEXT-DECORATION: underline
}
A.special_link:hover {
COLOR: #999999
}
A.brand {
FONT-SIZE: 7pt; COLOR: #777777; TEXT-DECORATION: none
}
.normal_txt {
FONT-SIZE: 8pt; COLOR: #4e81c4; FONT-FAMILY: Verdana,Arial,fixed
}
.small_txt {
FONT-SIZE: 7pt; WIDTH: 650px; COLOR: #777; FONT-FAMILY: Verdana,Arial,fixed; TEXT-ALIGN: justify
}
.logotext {
FONT-SIZE: 10pt; COLOR: #ffffff; TEXT-DECORATION: none
}
.main_table {
BORDER-RIGHT: #355d91 1px solid; BORDER-TOP: #adc2dd 1px solid; BORDER-LEFT: #adc2dd 1px solid; BORDER-BOTTOM: #355d91 1px solid; FONT-FAMILY: Verdana,Arial,fixed
}
</STYLE>
</BODY></HTML>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/