简体   繁体   中英

form around jquery dialog button?

I'm just wondering if it's possible to put a form around a button in a jQuery dialog . I've looked around and tried it myself in the JavaScript I'm using but can't seem to get it to work. If possible, I want it around the button "View Unread" as I need to pass something to the next page by a form.

I would post a picture but my rep isn't high enough:

Here is my code:

$("#notifiedDiv").dialog({
     resizable: true,
     height: 300,
     width: 400,
     autoopen: false,
     modal: true,
     buttons: {
         "View unread": function () {

         },
             "Ok": function () {

         }
     }
 });

It is bossible but I wouldn't recommend it.

Instead do this

"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*/
    }
    });
},

Check here more info about ajax

Include form in dialog div without button and link dialog button to this form:

"View unread": function () {
    $("#notifiedDiv form").submit();
},

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM