关于JQUERY的DataTableEditor 1.4:异步AJAX调用。我怎样才能把它放在后面?
在index.html上,我有两个页面jqmv.1.4 在第1页中,我有一个表单,可以获取(nombreUsuario)和密码并分配到相应的变量中 在第2页中,我想使用前面的(nombreUsuario)通过DataTableEditor 1.4上的AJAX获取与此nombeusario匹配的表 我的问题是,在第1页中,AJAX调用是在我输入nombreUsuario之前执行的,因此当传递到第2页时,表是空的,因为AJAX调用是使用变量empty执行的,没有nombreUsuario条目 我尝试了不同的代码,在输入nombreUsuario之后执行AJAX调用,但没有得到预期的结果。我用async来表示false,但什么也不做 此外,DataTable Editor AJAX文档还说: Success:不能被重写,因为它在数据表中内部使用。即便如此,我还是使用了这个选项(以jquery为例),这确实不起作用(是的,请告诉我!) 现在,在JQM?上解决它会更容易?。如何在第1页上获取nombreUsuario,并在传递到第2页之后,使用此变量执行AJAX调用 有什么想法吗?。提前谢谢你 index.html关于JQUERY的DataTableEditor 1.4:异步AJAX调用。我怎样才能把它放在后面?,ajax,jquery-mobile,asynchronous,datatable,editor,Ajax,Jquery Mobile,Asynchronous,Datatable,Editor,在index.html上,我有两个页面jqmv.1.4 在第1页中,我有一个表单,可以获取(nombreUsuario)和密码并分配到相应的变量中 在第2页中,我想使用前面的(nombreUsuario)通过DataTableEditor 1.4上的AJAX获取与此nombeusario匹配的表 我的问题是,在第1页中,AJAX调用是在我输入nombreUsuario之前执行的,因此当传递到第2页时,表是空的,因为AJAX调用是使用变量empty执行的,没有nombreUsuario条目 我尝试
<div data-role="page" id="page0">
<form id="formulario" >
<label> Usuario </label>
<input type="text" id="nombredeusuario" name="nombredeusuario">
<label> Password </label>
<input type="password" id="clave" name="clave" >
<input type="submit" value="Login" id="botonLogin">
</form>
...
<div data-role="page" id="page1">
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Establecimiento</th>
<th>Telefono</th>
<th>E-mail</th>
<th>Nº de Plazas</th>
<th>Precio medio</th>
<th>E-mail (responsable)</th>
<th>Prueba (1) / Contrato (2)</th>
</tr>
</thead>
....
JS(数据表编辑器1.4)
PHP(服务器端)
你能不能打电话给DataTable({‘例子’)?{…………在页面或页面上,PaGE-2的事件是怎样的?很不幸是不可能的,$$(''例子')。DataTable(…),在你的API中不考虑你可以使用PuxeRead或PayBebe。谢谢你。
$('#formulario').submit(function() {
// recolecta los valores que inserta el usuario
var datosUsuario = $("#nombredeusuario").val()
var datosPassword = $("#clave").val()
...
$('#example').DataTable( {
//check. start
initComplete: function(settings, json) {
alert( 'DataTables has finished its initialisation.' );
},
//check.end
dom: "Tfrtip",
ajax: {
async: false, // don't work
url:"http://tripntry.com/_country/spain/b.cartasconmenu.front.back.demo/alacarte/php/clientes.php",
type: "POST",
data: function ( d ) {
d.site = $("#nombredeusuario").val(); // dont work!
//d.site = datosUsuario; //// dont work!
//d.site = "34280001"; // works (of course)
},
....
include( "../../php/DataTables.php" );
// Alias Editor classes so they are easy to use
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Join,
DataTables\Editor\Validate;
$site=$_POST['site'];
// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'clientes' )
->fields(
Field::inst( 'tipo' )->validator( 'Validate::numeric' ), //this field another use
Field::inst( 'site' )->validator( 'Validate::notEmpty' )
)
->where( 'site', $site)
->process( $_POST )
->json();