2010-11-22 11 views

答えて

0

それが可能だ確かに送信AJAXでの使用のためにJavascriptを/ jQueryのにprocessingjsから変数を渡すことが可能です。多くの方法があります。一つの方法は、渡したい変数をwindowオブジェクトに添付することです。 の解決策ではなく、間違いなくの優雅なソリューションではありません。

したがって、このような何か:

// processingjs code... 
window.varIWantToPassAround = "whatever"; 

// jQuery code... 
// as long as you don't redefine the variable "varIWantToPassAround", you can reference it without referencing the window object. IE "window.varIWantToPassAround" 
// but I like to be explicit so when I read my code 3 months later and go "where did *that* come from, I can see it is attached to the window object. 
$("#unicorn_powerd_div").someFunctionThatGrowsMagicUnicorns(window.varIWantToPassAround); 
関連する問題