Raul, That demonstration of putting jdoajax(...) into the console was very clever and helpful. You may be on to something, but I am not sure because I don't quite follow your idea of "override ev_command_enter". Do you understand that in my app 'command' is my name of the event of entering a turtle command as text into the sole text field in the html document? If you already understood that, then maybe you are suggesting something wild like embedding that text field in something like a separate **hidden** input field (if that even is possible) that is automatically jdoajaxed just before or after the 'command' jdoajax, and is somehow able to collect the various multiple jhrajaxes from off of the/a stack? That would be quite a feat, but I like the idea.
On Sun, Mar 23, 2014 at 4:00 PM, Raul Miller <[email protected]> wrote: > Oops, there's no 'command' argument to jdoajax. I'd have to look a bit more > to determine where command comes from. Might be easiest to just override > ev_command_enter in tgsj. I'm sure there's cleaner ways of approaching > this, but I've other things occupying my attention right now so am not > inclined to go looking for them. > > Thanks, > > -- > Raul > > > On Sun, Mar 23, 2014 at 3:58 PM, Raul Miller <[email protected]> > wrote: > > > Here's jdoajax: > > > > function jdoajax(ids,data,sentence,async) { > > if(0!=rqstate) return; // previously - alert("busy - wait for previous > > request to finish"); > > async= (!async)?false:async; > > sentence=sentence||jevsentence; > > data=data||""; > > ids=ids||[]; > > rq= newrq(); > > if(async) rq.onreadystatechange= jdor; > > rq.open("POST",jform.jlocale.value,async); // true for async call > > jform.jdo.value= ('undefined'==typeof sentence)?jevsentence:sentence; > > rq.send(jpostargs(ids)+"&jdata="+jencode(data)+"&jwid="+jencode( > > window.name)); > > if(!async)jdor(); > > } > > > > If I open up the javascript console in my jijx window and execute > > > > jdoajax([],'','i.3') > > > > I get to see i.3 entered in the jijx window (and its result). > > > > If I instead do: > > jdoajax([],'','i.3');jdoajax([],'','i.4');jdoajax([],'','i.5'); > > > > I get to see all three lines entered and their results displayed. > > > > That said, if I turn on async: > > > > jdoajax([],'','i.3',1);jdoajax([],'','i.4',1);jdoajax([],'','i.5',1); > > > > only the first one gets executed. > > > > Looking closer, in the first set of three, three http requests are posted > > to the server. But when I pass the fourth "async" argument, the browser > > only makes the first request. > > > > Meanwhile, looking at your code, I think the problem is that jhrajax does > > not belong in 'paint'. jhrajax belongs at the top level > > > > So now the question is "what is the top level"? > > > > When I look at the stack in place when paint executes for fd 20, it looks > > like this: > > > > paint > > advance > > fd > > ev_command_enter > > jev_tgsj_ > > > > The bottom two levels are pre-defined, in jhs. You could have fd be the > > top level, but then it would not make sense to have other routines call > fd. > > (Because, if they did, it would violate our abstraction of considering > fd > > the "top level".) > > > > You could override ev_command_enter, and that might be ok. Here's what it > > looks like: > > > > ev_command_enter_tgsj_ > > 3 : '". s=. getv ''command''' > > > > That feels a bit messy though. So maybe it would be better to define > > ev_command_turtle_tgsj_ (I am presuming that the command argument to > > jdoajax should be 'turtle' to make this work - but I've not tested it.). > > Then you'd copy the line from ev_command_enter and add your jhrajax line > > there. > > > > Thanks, > > > > -- > > Raul > > > > > -- (B=) ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
