Вот все, что я пишу:
<form id="subscribe" name="subscribe" method="post" action="/smartmail/subscribe.php" accept-charset="windows-1251" target="_top">
<input type="hidden" name="id_chanel[]" value="1">
<input type="text" name="realName" size="20" value="Ваше имя" onblur="if(this.value=='') this.value='Ваше имя';" onfocus="if(this.value=='Ваше имя') this.value='';">
<input type="text" name="emailAdress" size="20" value="E-mail" onblur="if(this.value=='') this.value='E-mail';" onfocus="if(this.value=='E-mail') this.value='';">
<input class="subscribe" type="submit" name="submit" value="Подписаться">
</form>
<form class="form" method="post">
<label>ФИО полностью</label>
<input type="text" name="name" id="name" format=".+" notice="Введите имя" value="{$name|escape}" maxlength="255" />
<label>E-mail</label>
<input type="text" name="email" id="email" format="email" notice="Введите email" value="{$email|escape}" maxlength="255" />
<label>Придумайте пароль</label>
<input type="password" name="password" id="password" format=".+" notice="Введите пароль" value="" />
<br /><br /><div class="labelreg"><label for="comment_captcha">Введите код :</label></div>
<div class="captchareg"><img src="captcha/image.php?{math equation='rand(10,10000)'}"/></div>
<input class="input_captchareg" id="comment_captcha" type="text" name="captcha_code" value="" format="\d\d\d\d" notice="Введите капчу"/>
<label> </label>
<input style="display:none;" type=submit class="button_reg_submit" id="submit_btn" name="register" value="Зарегистрироваться">
<a href="javascript:;" onclick="ajax_send()" style="float:right; font-size: 8px;">Send</a>
</form>
<script>
function ajax_send()
{
var first_form = $('.form');
name_1 = $('input[name="name"]',first_form).val();
email_1 = $('input[name="email"]',first_form).val();
password_1 = $('input[name="password"]',first_form).val();
confirm_1 = $('input[name="register"]',first_form).val();
dataString_1 = 'name=' + name_1 + '&email=' + email_1 + '&password=' + password_1 + '®ister=' + '®ister=' + confirm_1;
$.ajax({
type: "POST",
url: "/user/register",
data: dataString_1,
success: function() {
alert('First form was send');
}
});
var second_form = $('#subscribe');
id_chanel_2 = $('input[name="id_chanel[]"]',second_form).val();
name_2 = name_1 ;
email_2 = email_1 ;
confirm_2 = $('input[name="submit"]',second_form).val();
dataString_2 = 'id_chanel[]=' + id_chanel_2 + '&realName=' + name_2 + '&emailAdress=' + email_2 + '&submit=' + confirm_2;
$.ajax({
type: "POST",
url: "/smartmail/subscribe.php",
data: dataString_2,
success: function() {
$('#result').html;
}
});
}
</script>