Foren / Cotonti / Support / Question about Json requests

Dyllon
#37313 26. März 2013, 18:01

I'm looking to create something similar to Cotonti.com's private message feature. I've been browsing around through the source code, but I don't know how to achieve it. From what I gather, this is the main part of it on the javascript end:

$.getJSON('index.php?r=pm_json', function(data)
{	
	var rows = '<ol>';
	$.each(data, function(key, val)
	{
		console.log(val);
		var url = 'pm?m=message&amp;id=0'.replace('0', val.pm_id);
		rows += '<li><a href="'+url+'">'+val.pm_title+'</a><small>Sender: '+val.pm_fromuser+'</small></li>';
	});
	rows += '</ol>';
	$('#pmbox').prepend(rows);
});

I just can't seem to figure out how to PHP side of it goes. Any insight?

We are what we repeatedly do. Excellence then, is not an act, but a habit.