开发者

pyfacebook and javascript query

I'm using pyfacebook on the backend and javascript on the client side. Now if I want to pass a variable t开发者_开发知识库o the javascript from pyfacebook. how would I go about doing that, any ideas?


You can't pass a variable directly, as JavaScript is running on the client (browser), and Python is running on the server. You could make a XHR (AJAX) request from JavaScript to the server which would then return your values back to JS (JSON could be used here). Or you could put a hidden field to your markup that would have the value in it's "value" attribute. You could then read that with JavaScript.

ps: your question really isn't related to pyfacebook but Python (or any other server side technology) in general and that has been covered here many many times.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜