I am using form submit jquery to a html page. Data is successfully delivered to my backend beego(golang framework) controller. After running some functions the controller had to decide where to redirect next. But this is been blocked by the jquery. How can I override jquery and redirect using go code?
My script
$().ready(function() {
$("#signupForm").validate({
rules: {
fullname: "required"
},
messages: {
fullname: "Please enter your full name"
},
submitHandler: function(form){
$(form).ajaxSubmit({
url: '/add_user',
type: 'POST',
dataType: 'html',
data : $( "#signupForm" ).serialize(),
success : function(data) {
}
});
return false
}
});
});
My code
status := user.AddUserAndCompany(company)
switch status {
case true:
this.Data["Website"] = "beego.me"
this.Data["Email"] = "astaxie@gmail.com"
this.TplName = "index.tpl"
case false:
this.Data["ErrorMessage"] = "ServerConnectionError"
this.Layout = "layouts/header_logout.html"
this.TplName = "templates/registration.html"
}
I have the same problem right now, what's the way forward ?
RépondreSupprimer