Tuesday, 15 February 2011

javascript - Embedly API returns String instead JSON -



javascript - Embedly API returns String instead JSON -

i'm testing embedly api , have problem returning. code in javascript followig send url php.

javascript

$.post('../../../services/rpc.php', {functionname: 'getembed', url: $('#story-post-new').val()}, function(response){ $.each(response, function(index, val){ ... }); })

php

$url = 'http://api.embed.ly/1/extract?url='.$_post['url'].';key=xxx;'; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); echo json_encode(curl_exec($ch));

so in php phone call api using extract, execute url , json_encode string returned. in javascript response not json object , still beingness string, $.each funcion doesn't work.

how can homecoming json php??

thanks.

the problem solved. happening? embedly returns string number @ end of , if tried json.parse wrong. stupid thing...

javascript php json embedly

No comments:

Post a Comment