I have a variable on a page like this:
var userdetails = "{ 'id': '1', 'username': 'me', }";
now, I wanna call a function to load those id and username in some divs like this one:
loaduser(userdetails)
I used this but didn't work
function loaduser(jsoni){
$.getJSON(jsoni, function(data) { $('#id').html(data.id); $('#username').html(data.username); } }
thank u guys ;)