my cashier project build in laravel. i need print receipt from web browser via mobile bluetooth.
i use mike42/escpos and RawBT package.
my program is working fine when running in localhost. but, doesn't work in live server
this is my VIEW :
<button
onclick="ajax_print('{{url('/cashier/pay',[$id])}}',this)"
class="btn btn-sm btn-warning">Pay
</button>
this is my AJAX
function ajax_print(url, btn) {
b = $(btn);
b.attr('data-old', b.text());
b.text('wait');
$.get(url, function (data) {
window.location.href = data; // main action
}).fail(function () {
alert("ajax error");
}).always(function () {
b.text(b.attr('data-old'));
})
}
and this is my Controller :
try{
$profile = CapabilityProfile::load("POS-5890");
$connector = new RawbtPrintConnector();
$printer = new Printer($connector, $profile);
// Content
$printer->setJustification(Printer::JUSTIFY_CENTER);
$printer->selectPrintMode(Printer::MODE_DOUBLE_WIDTH);
$printer->text("Hello World.\n");
//Print
$printer->cut();
$printer->pulse();
} catch (Exception $e) {
return redirect()->route('cashierindex')->with('error','Something Error');
} finally {
$printer->close();
}
Can you help me, why this code doesn't work in live server, but working fine in localhost ?
I assume that is a touch little bit of problem..
in mike42 you have to spark off the requirement personal home page extension to your server. in your case, you forgot activating required extension