我的代码有问题吗?
我不认为有,但这不会加载到 Facebox 中:
$("#email").submit(function(event) {
event.preventDefault();
if ($("#tinput").val() == "") {
$('#error').append('You need to select a template.<br />');
} else if ($("#tsubject").val() == ""){
$('#error').append('Subject cannot be blank.<br />');
} else if ($("#tmessage").val() == "") {
$('#error').append('Message cannot be blank.<br />');
} else {
$('#ecanvas').html('<center><img src="/templates/v2/images/loading.gif" /></center>');
var formdata = $(this).serialize();
$.post("/wizard/email-add", formdata, function (data) {
$('#ecanvas').html(data);
});
return false;
})
这可以正常工作:
$("#email").submit(function(event) {
event.preventDefault();
$('#ecanvas').html('<center><img src="/templates/v2/images/loading.gif" /></center>');
var formdata = $(this).serialize();
$.post("/wizard/email-add", formdata, function (data) {
$('#ecanvas').html(data);
});
return false;
})
我应该提到 #ecanvas、#error、#tinput、#tsubject 和 #tmessage 都存在。
I don't think there is but this wont load inside facebox:
$("#email").submit(function(event) {
event.preventDefault();
if ($("#tinput").val() == "") {
$('#error').append('You need to select a template.<br />');
} else if ($("#tsubject").val() == ""){
$('#error').append('Subject cannot be blank.<br />');
} else if ($("#tmessage").val() == "") {
$('#error').append('Message cannot be blank.<br />');
} else {
$('#ecanvas').html('<center><img src="/templates/v2/images/loading.gif" /></center>');
var formdata = $(this).serialize();
$.post("/wizard/email-add", formdata, function (data) {
$('#ecanvas').html(data);
});
return false;
})
This works without any problems:
$("#email").submit(function(event) {
event.preventDefault();
$('#ecanvas').html('<center><img src="/templates/v2/images/loading.gif" /></center>');
var formdata = $(this).serialize();
$.post("/wizard/email-add", formdata, function (data) {
$('#ecanvas').html(data);
});
return false;
})
I should mention #ecanvas, #error, #tinput, #tsubject and #tmessage all exist.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您未能关闭
else
的左大括号You failed to close the opening brace of the
else