I have a curl statement that pulls json formatted array to php. I then want to transfer this array to jQuery so that the client side will hold the array. I'm currently using the below method:
<script>var obj = jQuery.parseJSON( <?php echo var_dump($json_short); ?> );</script> The client sees something like:
<script>var obj = jQuery.parseJSON( array(1) { ["search"]=> array(50) { [0]=> array(6) { ["id"]=> string(6) "641279" ["description"]=> string(36) "Instyle - Responsive Portfolio Theme" ["url"]=> string(69) "http://themeforest.net/item/instyle-responsive-portfolio-theme/641279" ["type"]=> string(9) "wordpress" ["sales"]=> string(3) "135" ["rating"]=> string(3) "4.5" } .... } } );</script> Will obj now hold the array? is this the right way becuase I'm getting an error:
Uncaught SyntaxError: Unexpected token {
JSON.parse()expect parameter to be a string.