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] ); |
|
if ( a[0] > 0 && ! rfid_selected[ a[0] ] ) { |
|
|
$('#koha').append( '<div class="item" id="' + a[0] + '">Loading item '+a[0]+' from Koha</div>' ) |
|
|
$.get( '/koha/' + a[0], function(data) { |
|
|
$('#'+a[0]).html( data ); |
|
9 |
|
|
10 |
rfid_selected[ a[0] ]++; |
var id = a[0]; |
11 |
var e = $('#clear_selection'); |
|
12 |
e.attr( 'value', parseInt( e.attr('value') ) + 1 ); |
console.debug( id, rfid_selected[id] === undefined ); |
13 |
console.info('loaded item', a[0], data, 'selected', e.attr('value')); |
|
14 |
|
if ( id > 0 && rfid_selected[ id ] === undefined ) { |
15 |
|
if ( $('#'+id).length > 0 ) { |
16 |
|
console.error('element', id, 'allready exists'); |
17 |
|
} else { |
18 |
|
$('#koha').append( '<div class="item" id="'+id+'">Loading item '+id+' from Koha</div>' ) |
19 |
|
console.debug('created element', id); |
20 |
|
} |
21 |
|
$.get( '/koha/' + id, function(data) { |
22 |
|
$('#'+id).html( data ); |
23 |
|
|
24 |
|
if ( rfid_selected[id] === undefined ) { |
25 |
|
var e = $('#clear_selection'); |
26 |
|
e.attr( 'value', parseInt( e.attr('value') ) + 1 ); |
27 |
|
console.info('loaded item:', id, ' times:', rfid_selected[ id ], 'total selected:', e.attr('value')); |
28 |
|
} |
29 |
|
|
30 |
|
rfid_selected[ id ] = data; |
31 |
}); |
}); |
32 |
} else if ( a[0] < 0 ) { |
} else if ( id < 0 ) { |
33 |
console.info("No RFID chips in range"); |
console.info("No RFID chips in range"); |
34 |
} |
} |
35 |
}; |
}; |