2
$('<form method="post" action="login/makeLogin"><input type="hidden" name="fbphoto" value="'+image +
                    '"><input type="hidden" name="fbname" value="'+response.first_name +'"><input type="hidden" name="fbemail" value="'+response.email +'"><input type="hidden" name="fbid" value="'+response.id+
                    '"><input type="hidden" name="fbsurname" value="'+response.last_name +'"><input type="hidden" name="fbfriends" value="'+json +'"></form>').appendTo('body')

I create this form dynamicly with javascript. But when I try to send this form to a php function, it returns false when I try to access the fbfriends property the rest values work fine. The value of fbfriends is a string containing json, which I get using:

var json=JSON.stringify(response.friends);

If I dont stringify the json I get a string [Object object] when retrieving values in the php function. How can I send json through a form.

4

1 回答 1

1

您的表单仅包含隐藏项目。为什么不直接通过 $.ajax 发布响应值?

于 2013-03-13T21:38:25.857 回答