在 Spring MVC 和 Portlet 中使用 ajax 调用保存记录后显示 jquery 对话框
我使用 Spring 3.0 MVC 开发了表单,也使用了 Portlet。我有以下要求
- 当用户单击“保存”按钮存储记录时,
- 如果未存储记录或发生验证错误,同一页面应显示错误消息。
保存记录后 - 显示确认框/提示框(带有“是”和“否”按钮)询问“是否继续”
- 如果用户单击“是”按钮页面应刷新或重置。
- 如果用户单击“否”按钮页面应返回到另一个页面。
我为此编写了以下代码“
function storeButtonClick() {
$.ajax({
url: '${myUrl}',
data:$('#myForm').serialize(),
success: function(data){
$.jqDialog.confirm("Do you want to Continue?",
function()
{
alert("This intrusive alert says you clicked YES");
}, // callback function for 'YES' button
function() {
alert("This intrusive alert says you clicked NO");
} // callback function for 'NO' button
);
},
error : function(request) {
alert("in error");//+request.responseText);
}
})
}
我的页面未显示错误消息”。
请建议我如何正确开发此页面。我肯定错过了一些ajax的东西。
I have developed form using Spring 3.0 MVC also used Portlets. I have a following requirement
- When user click on save button store record
- If record is not stored or validation error occurs same page should display error message.
After record is saved - Display a Confirm Box / Prompt Box (with Yes and No button) to ask "Do you want to continue"
- If user click on YES button page should be refresh or reset.
- If user click on NO button page should go back to another page.
I have written following code for this
function storeButtonClick() {
$.ajax({
url: '${myUrl}',
data:$('#myForm').serialize(),
success: function(data){
$.jqDialog.confirm("Do you want to Continue?",
function()
{
alert("This intrusive alert says you clicked YES");
}, // callback function for 'YES' button
function() {
alert("This intrusive alert says you clicked NO");
} // callback function for 'NO' button
);
},
error : function(request) {
alert("in error");//+request.responseText);
}
})
}
My page is not getting displayed with an error message.
Please suggest me how can I develope this page correctly. I'm definitely missing some ajax things.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论