[jQuery] Submit a form?
[jQuery] Submit a form?
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:Arial;
color:windowtext;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-CA style='font-size:
10.0pt;font-family:Arial'>Using jQuery, is there an easy way to find a form in
an HTML document, submit it, then return “false” (to avoid
resubmission of the form).<o:p></o:p></span></font>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-CA style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-CA style='font-size:
10.0pt;font-family:Arial'>Using the HTML snippet:<o:p></o:p></span></font>
<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face="Courier New"><span
lang=EN-CA style='font-size:10.0pt;font-family:"Courier New"'><form
id="report-form" action="test_charts.jsp"
method="post"><o:p></o:p></span></font>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:36.0pt'><font size=2
face="Courier New"><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New"'><input
type="text" name="chart_value" value="Test chart
value" /><o:p></o:p></span></font>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:36.0pt'><font size=2
face="Courier New"><span lang=EN-CA style='font-size:10.0pt;font-family:"Courier New"'><input
id="report-submit" type="submit" value="Chart
it!" /><o:p></o:p></span></font>
<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face="Courier New"><span
lang=EN-CA style='font-size:10.0pt;font-family:"Courier New"'></form></span></font><font
size=2 face=Arial><span lang=EN-CA style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-CA style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-CA style='font-size:
10.0pt;font-family:Arial'>… and the Javascript:<o:p></o:p></span></font>
<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face="Courier New"><span
lang=EN-CA style='font-size:10.0pt;font-family:"Courier New"'>$('#report-submit').click(function()
{<o:p></o:p></span></font>
<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face="Courier New"><span
lang=EN-CA style='font-size:10.0pt;font-family:"Courier New"'> $('#report-form').submit();<o:p></o:p></span></font>
<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face="Courier New"><span
lang=EN-CA style='font-size:10.0pt;font-family:"Courier New"'> return
false; /* cancel the form submission */<o:p></o:p></span></font>
<p class=MsoNormal style='text-indent:36.0pt'><font size=2 face="Courier New"><span
lang=EN-CA style='font-size:10.0pt;font-family:"Courier New"'>});</span></font><font
size=2 face=Arial><span lang=EN-CA style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-CA style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-CA style='font-size:
10.0pt;font-family:Arial'>… the form does not appear to be submitted.
Thanks in advance for any help!<o:p></o:p></span></font>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-CA style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-CA style='font-size:
10.0pt;font-family:Arial'>~ David<o:p></o:p></span></font>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-CA style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font>
</div>
</body>
</html>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/