Brian, I see you switched to trying ajax in your latest version. I can take a look at it tomorrow. Here's the version from your previous message. It correctly fires ev_command_enter on my chrome browser when I hit enter. It also returns the result of the evaluation:
I suspect your ajax version had the same issue. You need to return a valid HTTP response from the POST or ajax response. In this case, I am calling create with the parameter evaluated from ev_command_enter. The valid HTTP response is created and output using jhr coclass'tgsj' coinsert'jhs' HBS=: 0 : 0 '<h2>Type in a turtle command</h2>' 'command' jhtext '1+1';20 'Result: <RESULT>' '<canvas width="600" height="300" id="glcanvas"></canvas>' ) jev_get=: create create=: 3 : 0 'tgsj'jhr'RESULT';y T=: 20 ) ev_command_enter=: 3 : 0 T=:T+1 s=: getv 'command' ret=:". s NB. return valid HTTP response create ": ret ) JS=: 0 : 0 NB. javascript function ev_body_load(){} // must use JHS framework load handler function ev_command_enter(){jsubmit();} ) On Mon, Mar 3, 2014 at 11:24 PM, Brian Schott <schott.br...@gmail.com> wrote: > Joe, > > I am pretty sure that is not the problem. ev_sentence_enter is never > executed, or else I would get the smoutput or the value of T would be > increased. I have trimmed the code as follows, and cannot get the > ev_sentence_enter to execute, at all. I got rid of initTurtles and the > init() and etc. I understand that ev_sentence_enter needs to post a > response, but I cannot even get ev_sentence_enter to execute. Can you see > what is wrong? > > Thanks, > > coclass'tgsj' > coinsert'jhs' > > > NB. HEXTRA put in html after CSS and before JS (because some things need to > come before HBS) > HEXTRA=: 0 : 0 > <script type="text/javascript" > src="~addons/ide/jhs/js/webgl/glmatrix-min.js"></script> > ) > > HBS=: 0 : 0 > '<h2>Type in a turtle command</h2>' > 'sentence' jhtext '3+2';10 > ) > > jev_get=: create > > create=: 3 : 0 > smoutput 'IN create' > 'tgsj'jhr'' > T=: 20 > ) > > ev_sentence_enter=: 3 : 0 > T=:T+1 > smoutput seebox NV > s=: getv 'sentence' > ". s > ) > > > CSS=: 0 : 0 > body{margin:10px;} > ) > > JS=: 0 : 0 NB. javascript > function ev_body_load() // must use JHS framework load handler > function ev_sentence_enter(){jdoajax(["sentence"],"");} > ) > > > > On Mon, Mar 3, 2014 at 10:40 PM, Joe Bogner <joebog...@gmail.com> wrote: > >> Brian, I get the following error when I run it: >> >> ev_body_load failed: ReferenceError: init is not defined, which is >> required since the javascript calls it here: >> >> function ev_body_load(){init();} // must use JHS framework load handler >> >> In jijx, I see this: >> >> |value error: initTurtles >> | initTurtles 1 >> >> >> In the code you pasted, I don't see initTurtles defined either >> >> Lastly, your post is failing because ev_command_enter needs to return >> a jhr response... >> >> ev_command_enter=: 3 : 0 >> T=:T+1 >> s=: getv 'command' >> ". s >> >> NB. NEED TO ADD SOMETHING LIKE BELOW >> create '' >> ) >> >> > -- > (B=) > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm