[英]form around jquery dialog button?
我只是想知道是否可以在jQuery對話框中的按鈕周圍放置表單。 我環顧四周,並在正在使用的JavaScript
中親自嘗試了一下,但似乎無法使其正常工作。 如果可能的話,我希望它圍繞“查看未讀”按鈕,因為我需要通過表單將內容傳遞給下一頁。
我會發布圖片,但是我的代表不夠高:
這是我的代碼:
$("#notifiedDiv").dialog({
resizable: true,
height: 300,
width: 400,
autoopen: false,
modal: true,
buttons: {
"View unread": function () {
},
"Ok": function () {
}
}
});
它很容易上手,但我不推薦。
而是這樣做
"View unread": function () {
$.ajax({
url:"the action url"
data: {"name": "value" } /*key values like name+values of your forms input*/
success:function(data) {
/*do something with the response*/
}
});
},
在對話框div
包含不帶按鈕的表單,並將對話框按鈕鏈接到此表單:
"View unread": function () {
$("#notifiedDiv form").submit();
},
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.