简体   繁体   中英

page in jquery dialog box

I have dataTable which last column for edit. I have a separate page for edit form. what i want is when edit link is clicked open that page in a jQuery dialog box and submit data.

The correct way to solve this problem

Assuming that you want a popup or a more specific term modal to edit the form, you should not have a separate html view for that but actually make a general form and post data using ajax. Creating a separate page defeats that purpose.

Now assuming that you still want to have a separate page for that. The modal should be like

<div class="modal">
    <iframe src="" id="frameSrc">
    </iframe>
</div>

where the src contains the url of the page that you want to open, i am guessing from the href . So here is how you would do that in javascript

$(this).on("click", function () {
    var editUri = $this.attr('href');
    document.getElementById('frameSrc').src = editUri;
});

The javascript will get the url from href and substitute the src in iframe tag in modal.

Hope this helps..

you can do this without alert and you don't need send href to jquery use fadeIn and some style to make it.

 $('a#login').click(function(){ $("#bgstyle").fadeIn('slow'); $('form').fadeIn('slow'); }) 

Fiddle DEMO hope this help you

anyway if i wanna do this i prefer to use bootstrap modal.

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