1 |
// Set this to something unique to this client |
// Set this to something unique to this client |
2 |
|
|
3 |
|
var rfid_visible = {}; |
4 |
|
|
5 |
function process(data) { |
function process(data) { |
6 |
var a = data.split('|'); |
var a = data.split('|'); |
7 |
console.info('process', a); |
console.info('process', a); |
8 |
$('#test').html( a[1] ); |
$('#test').html( a[1] ); |
9 |
if ( a[0] > 0 ) { |
if ( a[0] > 0 && ! rfid_visible[ a[0] ] ) { |
10 |
$('#koha') |
$('#koha').append( '<div class="item" id="' + a[0] + '">Loading item '+a[0]+' from Koha</div>' ) |
11 |
.html( 'Loading item '+a[0]+' from Koha' ) |
$('#' + a[0]).load( '/koha/' + a[0] ); |
12 |
.load( '/koha/' + a[0] ) |
rfid_visible[ a[0] ]++; |
|
; |
|
13 |
} else if ( a[0] < 0 ) { |
} else if ( a[0] < 0 ) { |
14 |
$('#koha').html( '--' ); |
$('#koha').html( 'No RFID chips in range' ); |
15 |
|
rfid_visible = {}; |
16 |
} |
} |
17 |
}; |
}; |
18 |
|
|