i used the answer of this question Nodejs - How to show qr-image result in view
server-side i got:
var express = require('express');
var router = express.Router();
var qr = require('qr-image');
router.get('/qrimage/:text', function(req,res){
var code = qr.image(req.params.text, { type: 'png'});
res.setHeader('Content-type', 'image/png');
res.pipe(code);
res.end();
});
client-side with jQuery:
var thisUserName = 'bobby';
$.get('/users/qrimage/'+ thisUserName);
var img = $("<img />").attr('src', 'users/qrimage/'+ thisUserName).load(function() {
$("#qrim").replaceWith(img);
});
the client-side code will be executed, when you click on a link. My problem is that the browser gets something but the image is not displayed properly.
console on click:
GET /users/qrimage/bobby 200 67.484 ms - -