JQuery Mobile Delete confirmation Dialog

1.7k Views Asked by At

I am new to jquery and really struggling for setting up confirmation dialog box for deleting certain items. I am able to view the popup but when I click DELETE on the popup its not redirecting or loading the new page but staying on same page. I am using Jquery mobile 1.3.2 version.

Any assistance to resolve this would be very helpful. Below is the sample code I am using.

<body> 

<div data-role="page" class="type-interior">

<?php include "files/header2.php";?>    

<div data-role="content" data-theme="d" >
    <div class="content-primary">


        <h2><img src="images/insert_table.gif" alt="">Confirmation </h2>

            <a href="#popupDialog" data-rel="popup" data-position-to="window" data-role="button" data-transition="pop" data-icon="delete" data-theme="b" data-mini="true">Delete</a>
            <div data-role="popup" id="popupDialog" data-overlay-theme="b" data-theme="d" data-dismissible="false" style="max-width:400px;" class="ui-corner-all">
                <div data-role="header" data-theme="a" class="ui-corner-top">
                    <h1>Delete Item ?</h1>
                </div>
                <div data-role="content" data-theme="d" class="ui-corner-bottom ui-content">
                    <h3 class="ui-title">Are you sure you want to delete this Item ?</h3>
                    <p>This action cannot be undone.</p>
                    <a href="#" data-role="button" data-inline="true" data-rel="back" data-theme="c">Cancel</a>
                    <a href="del_confirm.php" data-role="button" data-inline="true" data-rel="back" data-transition="flow" data-theme="b" rel="external">Delete</a>
                </div>
            </div>

</div><!--/content-primary -->      

1

There are 1 best solutions below

0
On

First of all you close popup calling this code

$("#popupDialog").popup("close");

then change page using this code

$.mobile.changePage('#id', { transition: "slide"}); //id means your redirection page id

finally delete items using jquery remove() function

$("#id").remove();

if you redirecting empty page means use jquery mobile Dialog

happy coding......