[jQuery] Sending form to php to send mai
<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Hello, I've been trying to submit a Form to a php file to send an email. I've already tested the script without jquery, to make sure the php works ok.<DIV><BR class="khtml-block-placeholder"></DIV><DIV>I haven't been able from the examples to know how to do it. This is the last I tried:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><B>This is what I have in my script tag in the head:</B></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>$(document).ready(function(){</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>$("input#submit").click(function(){</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>var params = $("input[@type=text]").serialize(); /*I try to get all the input fields here into value pairs*/</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>$("div#msg").ajax({</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>type:"POST";</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>url:"sendmails.php";</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>data:params;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>success:function(msg){</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>alert("sent ok! "+ msg);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>}</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>});</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>});</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>});</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><B>and this is my form:</B></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><form id="videos"></DIV><DIV><input type="hidden" name="uri" value="<A href="http://www.canaldevideos.com">
http://www.canaldevideos.com</A><?php print $_SERVER["SCRIPT_NAME"];?>"/></DIV><DIV><table cellpadding="0" cellspacing="0" border="0"></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><tr></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><td colspan="2" class="boldy">From:</td></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN></tr></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><tr></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><td><label for="t_name">Name:</label></td></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><td><label for="t_email">Email:</label></td></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN></tr></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><tr></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><td><input type="text" name="t_name"></td></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><td><input type="text" name="t_email"></td></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN></tr></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><tr></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><td colspan="2" class="boldy">Your Message (opcional):</textarea></td></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN></tr></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><tr></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><td colspan="2"><textarea id="message" name="message"></textarea></td></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN></tr></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><tr></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN><td colspan="2"><input type="submit" value="Send" id="submit"/></td></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN></tr></DIV><DIV></table></DIV><DIV></form></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>But the data goes through the adress bar, and it's totally messed up.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Any examples I can follow? I'm reading the "Ajax" documentation, and that's mainly where I'm trying to copy my examples from.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>-Thanks,</DIV><DIV>Gaston</DIV></BODY></HTML>_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/