jQuery Mobile doesn't load on JSON ajax result -
i'm trying load jquery mobile 'styles' (in case buttons).
here html code (ajax):
<!-- jquery + mobile (local) --> <link rel="stylesheet" href="../../jquery.mobile/jquery.mobile-1.3.2.min.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.js"></script> <script src="../../jquery.mobile/jquery.mobile-1.3.2.min.js"></script> <script> $.ajax({ type : "get", url : "http://localhost/asistencia/mant/scripts/s_m_zona.php?id_zona="+id_zona, async : true, success : function(datos) { var datajson = eval(datos); ( in datajson) { // code hede // guardar nombre zona $("#btn_guardar").html("<button data-ajax='false' onclick='guardarnombrezona("+datajson[i].id_zona+");return false;'>modificar nombre </button>"); $("#botones").html("<button data-ajax='false' onclick='remover("+datajson[i].id_zona+")'>crear nueva área</button>"); $("#crearnuevo").button('refresh'); } }, error : function(obj, error, objerror) { //avisar que ocurrió un error alert("error de red"); } }); </script> <body> <div data-role="page" id="index"> <div data-role="header"> <a href="../index.html" data-icon="back" data-iconpos="notext" rel="external" data-transition="fade">volver</a> <h3> modificar zona </h3> </div> <!-- header --> <div data-role="content"> <!-- <div id="zonas"> </div> <br/> --> <div id="botones"> </div> <table> <tr> <td>zona: <input type="text" id="zona_name" name="zona_name" /></td> <td><div id="btn_guardar"></div></td> </tr> </table> </div> <!-- content --> </div> </body>
the buttons on #btn_guardar , #botones divs show button , don't displays css jquery mobile.
thank answers, sry bad english
try using trigger("create");
after putting html of buttons on parent :
$("#btn_guardar").html("<button data-ajax='false' onclick='guardarnombrezona("+datajson[i].id_zona+");return false;'>modificar nombre </button>"); $("#btn_guardar").trigger("create"); $("#botones").html("<button data-ajax='false' onclick='remover("+datajson[i].id_zona+")'>crear nueva área</button>"); $("#botones").trigger("create");
Comments
Post a Comment