On Apr 15, 7:33 pm, sneaks <deroacheee...@gmail.com> wrote:
> for anyone having similar problem heres how i resolved it:
>
>         function getProductInfo(product_id) {
>                 jQuery.post(
>                         "/wp/wp-admin/admin-ajax.php", {
>                                 action: "getProductInfo",
>                                 'cookie': encodeURIComponent(document.cookie),
>                                 'product_id': product_id
>                         },function(json) {
>                                 var obj=eval('('+json+')');
>                                 jQuery.each(obj, function(i, val) {
>                                         jQuery('#'+i).attr('value',val);
>                                 });
>                 },"JSON");
>         }
>

Posting up relative paths to your PHP file does not help debug the
problem.

> the key is you need string brackets around the string json for the
> eval
>

Javascript has no such thing "String Brackets".

> good luck

Both guesswork and luck should be required to debug your problem from
this perspective.

But the problem is not that involved. Your dataType is is "JSON" not
"json"[1].

The example jquery code you provided expects your document to have an
element with ID for each property name in the JSON response. You
should have provided a complete example.

> j

Garrett
[1]http://docs.jquery.com/Ajax/jQuery.post#urldatacallbacktype

Reply via email to