4 Replies Latest reply on Nov 14, 2012 11:34 AM by Glenn Sayer

    CardReader Event Problems

    John Huffman

      We are using the Motorola ET1 and the new ET1 Scan/MSR Module(MSRSCAN) with RhoElements  To access the MSR interface we then use the JavaScript version of the RhoElements Card Reader interface to swipe the mag-stripe.


      When we implemented it, we had do some crazy stuff to be able to access the data from the swipe.  Essentially what you have to do is replace the carriage returns in the returned "jsonObject" with '\n' and then parse it to create an object.  More detail here, about the CardReader Problems.

      <META HTTP-Equiv="CardReader" Content="ReadEvent:url('javascript:doTransaction('%json');')">    
      <script language="javascript" type="text/javascript">
           function doTransaction(jsonObject) {
               jsonObject = jsonObject.replace(/\r/g, "\\n");
               var card = JSON.parse(jsonObject);
               // Now we have a real object
               alert("Data: " + card.data);
               alert("Mode: " + card.mode);