Your solution is pretty much how I'm handling it. Ajax requests are sent to various PHP files on a web server. The PHP files then make requests from a MYSQL database and echo the results which C3 picks up as the Ajax results.
The problem with this method: It's not fast. Depending on the server load (shared hosting), or how much processing the PHP file has to do or ping times, it could be seconds before you get results back.
Make sure that, if you need to, lock any controls to prevent repeatedly sending the Ajax request multiple times until the request gets and answer or it errors out.