我正在尝试将ajaxform 插件与 php 一起使用,请帮助我我无法实现我的目标
1-用户填写此表格,((即使我希望用户上传图片,但我在编码方面尽了最大努力但没有太多结果,所以我删除了 input type="file" ,如果您知道如何处理这个ajaxform 和 php 请编辑我的表单))
< form name="signup" autocomplete="on" id="signup_form" method="get" action="signup_feed.php">
<fieldset>
<legend>Sign Up</legend>
<label class="span-4" >First Name*:</label> <input type="text" id="u_fname" name="u_fname"/><br/>
<label class="span-4">Last Name*:</label><input type="text" id="u_lname" name="u_lname"/><br/>
<label class="span-4">Email*:</label><input type="email" id="u_email" name="u_email"/><br/>
<label class="span-4">Password*:</label><input type="password" id="u_pass" name="u_pass"/></br>
<label class="span-4">Re-type Password*:</label><input type="password" name="u_re_pass"/></br>
<label class="span-4">Phone no.:</label><input type="tel" id="u_phone" name="u_phone" /><br/>
<input type="submit" value="Sign up" class="button" id="sign_up_btn"/>
</fieldset>
</form>
2-使用 ajaxform 我希望提交上述表单的值,之后有 5 秒的倒计时重定向到 sign_in.php 页面
var options = {
target:'#sign_up_div',
success: function(){
$('#sign_up_div').replaceWith("<div id='signup_success_msg' class='success'></div>");
$('#signup_success_msg').html("<h3>You have registered ! </h3>")
.hide()
.fadeIn(1500, function() {
$('#signup_success_msg').append("<img id='checkmark' src='img/icon-check.png' />");
});
$('#signup_success_msg').append('<p>please sign up</p>').delay( 2500 ).fadeOut(1500, function() { $(this).remove(); });
},
url:signup_feed.php,
type:post
};
$('#signup_form').submit(function() {
// inside event callbacks 'this' is the DOM element so we first
// wrap it in a jQuery object and then invoke ajaxSubmit
$(this).ajaxSubmit(options);
// !!! Important !!!
// always return false to prevent standard browser submit and page navigation
return false;
});
3- php使用redbeansphp 存储数据
$user = R::dispense( 'user' );
$user->u_fname=$_GET['u_fname'];
$user->u_lname=$_GET['u_lname'];
$user->u_email=$_GET['u_email'];
$user->u_pass=$_GET['u_pass'];
$user->u_phone=$_GET['u_phone'];
$id = R::store($user);
echo "<p> Thank you for resigteration! Please sign in </p><p id='countdown'></p>
<p>if you still see this page , please <label><a href='sign_in.php'>click here</a></label> </p>";
我还是 Jquery 的新手,但我真的很想在我的表单中实现这些目标..