requestOne( function( data ) {
var r = false;
if ( data ) {
var r1 = data.id;
requestTwo( function( data ) {
if ( data ) {
var r2 = data.id;
console.log( r1 + r2 );
}
} );
}
} );
window.addEventListener( 'DOMContentLoaded', function() {
var form = document.getElementById( 'form_id' );
Array.from( document.getElementsByTagName( 'input' ) ).map( function( el ) {
if ( el.type == 'radio' && el.parentNode == form ) {
el.addEventListener( 'change', function() {
form.submit();
} );
}
} );
} );
function codeGen( number ) {
var base = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.split( '' );
var result = '', quotient, remainder;
do {
quotient = Math.floor( number / base.length );
remainder = number % base.length;
number = quotient - 1;
result = base[ remainder ] + result;
} while ( quotient > 0 );
return result;
}
<?php
require_once 'dy_functions.php';
$result = queryMysql( 'SELECT * FROM task' );
$date = array();
while ( ( $row = $result->fetch_array( MYSQLI_ASSOC ) ) !== false ) {
$date[] = $row;
}
echo json_encode( $date );
for ( $i = 0 ; $i < $result->num_rows ; $i ++ ) {
$date[] = $result->fetch_array( MYSQLI_ASSOC );
}