Don't open popup

Don't open popup

Hello!!

I'm new in jqmobile, and I would be very grateful If you could help me.

Te problem is, I load the page, next I click to open a popup but nothing happens (only in the url appears #&ui-state=dialog).

Then I reload the page, and try to open the same popup and now works properly.

Any idea?


Thank you for your help.

This is the code of the page:



<!DOCTYPE html>
<html>
<head lang="es">
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">

<script>
$(document).on("pageinit",".ui-page",function(){
    var $page = $(this);
    $page.on("swiperight swiperight",function(e){
        if ($page.jqmData( "panel" ) !== "open" ) {
            if ( e.type === "swipeleft"  ) {
                $page.find( "#navpanel" ).panel( "close" );
            } else if ( e.type === "swiperight" ) {
                $page.find( "#navpanel" ).panel( "open");
            }
        }
    });
});

function submitIdByAjax(formulario){
    var id      = document.getElementById(formulario).id.value;
    var action  = document.getElementById(formulario).action;
    $.ajax({
        type:'POST',
        url:action,
        data:('id='+id),
        success:function(respuesta){
            document.getElementById("popupnotifyText").innerHTML = respuesta;
            $( "#popupnotify" ).popup( "open" )
        }
    })
}

function addIdActionToFormSubmitAjax(formulario,id,action){
    addIdActionToForm(formulario,id,action);
    submitIdByAjax(formulario);
}
function addIdActionToFormSubmit(formulario,id,action){
    addIdActionToForm(formulario,id,action);
    submit(formulario);
}

function addIdActionToForm(formulario,id,action){
    document.getElementById(formulario).action   = action;
    document.getElementById(formulario).id.value = id;
}

function submit(formulario){
    document.getElementById(formulario).submit();
}

</script>

</head>
<body>
    
<div data-role="header" data-theme="b" data-position="fixed">
    <div>
            <a href="#navpanel" class="floatleft ui-btn ui-shadow ui-corner-all ui-btn-icon-notext ui-btn-inline ui-icon-bars"
                                   data-history="false">
            Panel</a>
            <div class="centrado">Clientes</div>
            <a href="/nuevoCliente" class="floatright ui-btn ui-shadow ui-corner-all ui-btn-icon-notext ui-btn-inline ui-icon-plus"
                                   data-history="false">
            Nuevo Cliente</a>
                <a href="/listaTocan" class="floatright ui-btn ui-shadow ui-corner-all ui-btn-icon-notext ui-btn-inline ui-icon-clock"
                                   data-history="false">
            Ordenados Desde Ultima Vez</a>
        </div>
</div>
<div data-role="panel" id="navpanel" data-position="left" data-display="overlay" data-position-fixed="true" data-theme="b">
    <ul data-role="listview">
        <a href="/listaClientes" class="ui-btn ui-btn-icon-left ui-shadow-icon ui-icon-bullets"
                                   data-history="false">
            Clientes a..z</a>
                <a href="/planning" class="ui-btn ui-btn-icon-left ui-shadow-icon ui-icon-calendar"
                                   data-history="false">
            Planning</a>
        
    </ul>
</div>


<div data-role="main" class="ui-content">
        <form>
            <input data-type="search" id="searchForCollapsibleSet">
    </form>
     <div data-role="collapsibleset" data-filter="true" data-inset="true" id="collapsiblesetForFilter" data-input="#searchForCollapsibleSet">
                <div data-role="collapsible" data-icon="false" data-mini="true" data-collapsed-icon="false" data-expanded-icon="false">
            <h2>A lo loco                                    <span class="ui-li-count">5600</span>
                            </h2>

            <div class="ui-mini ui-alt-icon">
                        <a href="#mapa" class="ui-btn ui-shadow ui-corner-all ui-btn-icon-notext ui-btn-inline ui-icon-navigation"
                            onClick="mostrarMapaSimple('41.0649303','1.0589888','map_canvas');"
                                        data-rel="popup" data-position-to="window"
                       data-history="false">
            Ver Mapa</a>
                <a href="#" class="ui-btn ui-shadow ui-corner-all ui-btn-icon-notext ui-btn-inline ui-icon-edit"
                            onClick="addIdActionToFormSubmit('formId','7','editarCliente');"
                                   data-history="false">
            Editar</a>
                <a href="#popupnotify" class="ui-btn ui-shadow ui-corner-all ui-btn-icon-notext ui-btn-inline ui-icon-calendar"
                            onClick="addIdActionToFormSubmitAjax('formId','7','toPlanning');"
                                        data-rel="popup" data-position-to="window"
                       data-history="false">
            Planificar</a>
                <a href="#popupBorrar" class="ui-btn ui-shadow ui-corner-all ui-btn-icon-notext ui-btn-inline ui-icon-delete"
                            onClick="addIdActionToForm('formId','7','eliminarCliente');"
                                        data-rel="popup" data-position-to="window"
                       data-history="false">
            Borrar</a>
                    </div>

            <b>Direccion:</b> Passeig Miramar 20            <b>Resto:</b> 
<pre>Array
(
   [id] => 7
   [diffDays] => 5600
)
</pre>                    
</div>
      </div>

<form method="post" name="formId" id="formId" data-transition="slide">
    <input type="hidden" id="id" name="id">
</form>


<div data-role="popup" id="popupBorrar" data-overlay-theme="a" data-theme="d" data-dismissible="false" class="ui-corner-all">
    <div data-role="header" data-theme="b" class="ui-corner-top">
        <h4>¿Borrar Cliente?</h4>
    </div>
    <div data-role="content" data-theme="a" class="ui-corner-bottom ui-content">
        <p>¿Esta seguro que quiere borrar este cliente?</p>
        <a href="#" data-role="button" data-inline="true" data-rel="back" data-theme="c">Cancelar</a>
        <a href="#" data-role="button" data-inline="true" data-transition="flow" data-theme="b"
           rel="external" onClick="submit('formId');">Aceptar</a>
    </div>
</div>

<div id="mapa"  data-role="popup" data-dismissible="false">
    <div id="map_canvas" style="width:400px;height:500px;"></div>
    <a href="#" class="ui-btn ui-mini ui-btn-b" data-rel="back">Cerrar</a>
</div>

<div data-role="popup" id="popupnotify" class="ui-content" data-transition="slideup" data-theme="b" data-overlay-theme="a">
    <p id="popupnotifyText"><p>
</div>