php array to jquery using json

php array to jquery using json

Hi!

I managed to get simple ajax example working, but when I try to pass an array of numbers to jquery, I had no luck.

Can someone please give me a simple example.

In php I have:

    $a=array(1,2,3,4,5);
   echo json_encode($a);

So, how can I get this in jquery variable like js_var=[1,2,3,4,5]?

p.s. Actually, my problem is jqplot and not being able to pass array from php to jqplot, but since I'm getting data using $.ajax, I guess this is the right place to ask.

Thank you!