|
View:
New views
18 Messages
—
Rating Filter:
Alert me
|
|
|
dojo.xhrgetHi
I tried to get this to work <script text="text/javascript" src="http://o.aolcdn.com/dojo/1.3/dojo/dojo.xd.js" djConfig="parseOnLoad:true,isDebug:true" /> </script> <script type="text/javascript"> dojo.addOnLoad(function(){ console.log("hi") dojo.xhrPost({ url: "http://www.scrapbookingsuppliesrus.com/catalog/layout", //who knows how to set relative urls? handleAs: "json", //get json data from server load: function(response, ioArgs){ console.log("got"); console.log(response); //helps with the debugging return response; }, error: function(response, ioArgs){ console.log("nope didn't make it", response+' '+ioArgs); return response; //who knows what this does } //last item, thus no extra comma }); }); </script> I reduced my code down to this, which doesn't work. Do I have to require it? It doesn't do anything and I have no clue why. It doesn't even throw an error in firebug and however firebug lets you step through the code is not very easy to use. Well, anyway, I'd appreciate the help _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: dojo.xhrgetHi i am a total newbie in Dojo but if i may, i would like to make the following suggestion for your load fxn. If it works you can correct the other function too load: function(response, ioArgs){ var responseText = ioArgs.xhr.responseText; console.log("got"); console.log(responseText); //helps with the debugging return responseText; }, and abt the url...if this url doesn't exist within your domain, then xhrPost will not work. If url is external to you domain, you will have to write a server proxy script to get what you need. From: dojonewb <martingaleh@...> To: dojo-interest@... Sent: Tue, November 3, 2009 12:11:17 AM Subject: [Dojo-interest] dojo.xhrget Hi I tried to get this to work <script text="text/javascript" src="http://o.aolcdn.com/dojo/1.3/dojo/dojo.xd.js" djConfig="parseOnLoad:true,isDebug:true" /> </script> <script type="text/javascript"> dojo.addOnLoad(function(){ console.log("hi") dojo.xhrPost({ url: "http://www.scrapbookingsuppliesrus.com/catalog/layout", //who knows how to set relative urls? handleAs: "json", //get json data from server load: function(response, ioArgs){ console.log("got"); console.log(response); //helps with the debugging return response; }, error: function(response, ioArgs){ console.log("nope didn't make it", response+' '+ioArgs); return response; //who knows what this does } //last item, thus no extra comma }); }); </script> I reduced my code down to this, which doesn't work. Do I have to require it? It doesn't do anything and I have no clue why. It doesn't even throw an error in firebug and however firebug lets you step through the code is not very easy to use. Well, anyway, I'd appreciate the help _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: dojo.xhrgetdojonewb wrote:
> Hi > I tried to get this to work > > <script > text="text/javascript" > src="http://o.aolcdn.com/dojo/1.3/dojo/dojo.xd.js" > djConfig="parseOnLoad:true,isDebug:true" > /> > </script> > This is the first problem. You have a mixed <script /> and <script></script> setup here. Dojo likely isn't being loaded. The trailing / in the first script tag should go away. > <script type="text/javascript"> > > > dojo.addOnLoad(function(){ > console.log("hi") > dojo.xhrPost({ > url: "http://www.scrapbookingsuppliesrus.com/catalog/layout", //who knows how > to set relative urls? > handleAs: "json", //get json data from server > load: function(response, ioArgs){ > console.log("got"); > console.log(response); //helps with the debugging > return response; > }, > error: function(response, ioArgs){ > console.log("nope didn't make it", response+' '+ioArgs); > return response; //who knows what this does > } //last item, thus no extra comma > }); > > > > }); > </script> > > sure why you aren't seeing any errors. dojo.js isn't loading is all. The rest is fine, assuming your local domain is www.scrapbookingsuppliesrus.com .. you can access that as a relative-absolute url like: dojo.xhrPost({ url:"/catalog/layout", load:function(response); }); Regards, Peter > I reduced my code down to this, which doesn't work. Do I have to require it? > It doesn't do anything and I have no clue why. It doesn't even throw an error > in firebug and however firebug lets you step through the code is not very easy > to use. Well, anyway, I'd appreciate the help > > > > _______________________________________________ > FAQ: http://dojotoolkit.org/support/faq > Book: http://docs.dojocampus.org > Dojo-interest@... > http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest > > -- Peter E Higgins Dojo Project Lead : http://dojotoolkit.org _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: dojo.xhrgetviban Terence wrote:
> Hi i am a total newbie in Dojo but if i may, i would like to make the > following suggestion for your load fxn. If it works you can correct > the other function too > > load: function(response, ioArgs){ > > var responseText = ioArgs.xhr.responseText; Just as an FYI, you don't need to go digging in ioARgs.xhr.responseText. If the handleAs is "text" (which is the default) the first param in the load function is ioArgs.xhr.responseText. Try it out: dojo.xhrGet({ url:"/foo.html", load:function(response, io){ if(response == io.xhr.responseText){ alert("see?"); } } }); Regards, Peter -- Peter E Higgins Dojo Project Lead : http://dojotoolkit.org _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: dojo.xhrgetSorry for all the noise, I didn't notice it before:
>> I tried to get this to work >> >> <script >> text="text/javascript" >> src="http://o.aolcdn.com/dojo/1.3/dojo/dojo.xd.js" >> djConfig="parseOnLoad:true,isDebug:true" >> /> >> </script> >> >> > > This is the first problem. You have a mixed <script /> and > <script></script> setup here. Dojo likely isn't being loaded. The > trailing / in the first script tag should go away. > a type="" implies text/javascript, so I was probably right the first time with the closing / in the script tag, but this is something else you need to watch out for. I am not ashamed to admit I have spent a bit too much time debugging why: <script type="test/javascript" src="dojo.js"></script> doesn't work. The type must be null or text/javascript for browsers to interpret it as javascript. Regards, Peter -- Peter E Higgins Dojo Project Lead : http://dojotoolkit.org _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: dojo.xhrgetOne other tip around:
> I would assume Firebug to report "dojo is not defined" in this case. Not > sure why you aren't seeing any errors. dojo.js isn't loading is all. > I often find Firebug not reporting errors. The simple trick is to go to the Script tab and "Break on all errors" (click the little arrow next to the tab to get these options). When you reload, the script will stop where it hits a problem. It'll stop all over the place with script errors on browser extensions and some try/catch blocks as well, so I turn it off as soon as I've found the problem--but sometimes that's the only way to find the problem quickly... Cheers, John Locke http://freelock.com -------- Original Message -------- Subject: Re: [Dojo-interest] dojo.xhrget From: Peter E Higgins <dante@...> To: dojo-interest@... Date: Mon 02 Nov 2009 04:12:13 PM PST > dojonewb wrote: > >> Hi >> I tried to get this to work >> >> <script >> text="text/javascript" >> src="http://o.aolcdn.com/dojo/1.3/dojo/dojo.xd.js" >> djConfig="parseOnLoad:true,isDebug:true" >> /> >> </script> >> >> > > This is the first problem. You have a mixed <script /> and > <script></script> setup here. Dojo likely isn't being loaded. The > trailing / in the first script tag should go away. > >> <script type="text/javascript"> >> >> >> dojo.addOnLoad(function(){ >> console.log("hi") >> dojo.xhrPost({ >> url: "http://www.scrapbookingsuppliesrus.com/catalog/layout", //who knows how >> to set relative urls? >> handleAs: "json", //get json data from server >> load: function(response, ioArgs){ >> console.log("got"); >> console.log(response); //helps with the debugging >> return response; >> }, >> error: function(response, ioArgs){ >> console.log("nope didn't make it", response+' '+ioArgs); >> return response; //who knows what this does >> } //last item, thus no extra comma >> }); >> >> >> >> }); >> </script> >> >> >> > I would assume Firebug to report "dojo is not defined" in this case. Not > sure why you aren't seeing any errors. dojo.js isn't loading is all. > > The rest is fine, assuming your local domain is > www.scrapbookingsuppliesrus.com .. you can access that as a > relative-absolute url like: > > dojo.xhrPost({ > url:"/catalog/layout", > load:function(response); > }); > > Regards, > Peter > >> I reduced my code down to this, which doesn't work. Do I have to require it? >> It doesn't do anything and I have no clue why. It doesn't even throw an error >> in firebug and however firebug lets you step through the code is not very easy >> to use. Well, anyway, I'd appreciate the help >> >> >> >> _______________________________________________ >> FAQ: http://dojotoolkit.org/support/faq >> Book: http://docs.dojocampus.org >> Dojo-interest@... >> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest >> >> >> > > > _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: dojo.xhrgetdojonewb <martingaleh <at> yahoo.com> writes:
> > Hi > I tried to get this to work > > <script > text="text/javascript" > src="http://o.aolcdn.com/dojo/1.3/dojo/dojo.xd.js" > djConfig="parseOnLoad:true,isDebug:true" > /> > </script> > <script type="text/javascript"> > > > dojo.addOnLoad(function(){ > console.log("hi") > dojo.xhrPost({ > knows how > to set relative urls? > handleAs: "json", //get json data from server > load: function(response, ioArgs){ > console.log("got"); > console.log(response); //helps with the debugging > return response; > }, > error: function(response, ioArgs){ > console.log("nope didn't make it", response+' '+ioArgs); > return response; //who knows what this does > } //last item, thus no extra comma > }); > > > > }); > </script> > > I reduced my code down to this, which doesn't work. Do I have to require > It doesn't do anything and I have no clue why. It doesn't even throw an error > in firebug and however firebug lets you step through the code is not very easy > to use. Well, anyway, I'd appreciate the help > > _______________________________________________ > FAQ: http://dojotoolkit.org/support/faq > Book: http://docs.dojocampus.org > Dojo-interest <at> mail.dojotoolkit.org > http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest > > This is unbelievable, I pitched this into the ether and never thought I'd get a response. Then I get an incredible amount of feedback that's been really unbelievable. I even got something from the founder of Dojo? Really? Well, I'll try my luck again. What a friendly group to put up with a hack like me. I figured out the xhrpost thing. It's because my script was local and my database was on my web server, which is a no no. Here's the next problem ( I wonder if this thing uses [code][/code] bitcode?) Firefox will accept: [code] dojo.create( "div", { class: "celloutside celloutside100", id: "div_out_"+result ['product_id'] }, dojo.query("#content")[0], "last" );[/code] After digging out why ie doesn't support this, I figured it out while reading the rhino book in the shower and made: [code] dojo.create( "div", { className: "celloutside celloutside100", id: "div_out_"+result ['product_id'] }, dojo.query("#content")[0], "last" );[/code] Isn't there something more elegant than dojo.query("#content")[0] Finally, I haven't really tested it yet, but ie doesnt like dojo.query(".goods, .error").delete so I had to comment that section out. I haven't tested if that command actually works or not. I know .removeChild seemed ok, but I figure dojo must have a better way. Better grip the sides of russell again. At the risk of embarassing myself, my wonderful script is at www.scrapbookingsuppliesrus.com/test2.inc.php Gotta practice before I put this somewhere for real. One day, I gotta try out the zend dojo combination rather than just jam things recklessly into a second head and body, but that require more expertise. Again Thanks again for all your help. p.s. This bottom posting thing. Doesnt' gmail top-post? _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: dojo.xhrgetOn Mon, Nov 9, 2009 at 4:21 PM, dojonewb <martingaleh@...> wrote:
> Isn't there something more elegant than dojo.query("#content")[0] dojo.byId("content") give the plain DOM node. > Finally, I haven't really tested it yet, but ie doesnt like > > dojo.query(".goods, .error").delete If I recall "delete" is a JavaScript reserved word. dojo.query(".goods .error").orphan() dojo.query returns a dojo.NodeList object. Some API docs are here: http://api.dojotoolkit.org/jsdoc/1.3.2/dojo.NodeList James _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: dojo.xhrgetdojonewb wrote:
> After digging out why ie doesn't support this, I figured it out while reading > the rhino book in the shower and made: > > IE doesn't support using "class" in unquoted form anywhere. > [code] > dojo.create( > "div", > { > className: "celloutside > celloutside100", > id: "div_out_"+result > ['product_id'] > }, > dojo.query("#content")[0], > "last" > );[/code] > > Isn't there something more elegant than dojo.query("#content")[0] > > dojo.create(node, attrs, ref, position); dojo.create("div", { ... }, "content"); // "last" is default position Anywhere you are working with a node by Id (#content) you can pass just the string id where it is expecting a domNode. Create/place/destroy/even byId all accept string|domNode signatures. > Finally, I haven't really tested it yet, but ie doesnt like > > dojo.query(".goods, .error").delete > > so I had to comment that section out. I haven't tested if that command > actually works or not. I know .removeChild seemed ok, but I figure dojo must > have a better way. Better grip the sides of russell again. > > You want .orphan() > At the risk of embarassing myself, my wonderful script is at > www.scrapbookingsuppliesrus.com/test2.inc.php > > Gotta practice before I put this somewhere for real. One day, I gotta try out > the zend dojo combination rather than just jam things recklessly into a second > head and body, but that require more expertise. > > Again Thanks again for all your help. > > p.s. This bottom posting thing. Doesnt' gmail top-post? > > > > _______________________________________________ > FAQ: http://dojotoolkit.org/support/faq > Book: http://docs.dojocampus.org > Dojo-interest@... > http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest > > Peter -- Peter E Higgins Dojo Project Lead : http://dojotoolkit.org _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
[Event] Checking for dojo.keys.SPACE?Hi,
I'm capturing a key press event triggered by the space bar. I then want to see whether it's the space bar, so I do this: alert( onKeyPressEvent.keyCode + " " + dojo.keys.SPACE ); The result is: 0 32 So keyCode is 0 and dojo.keys.SPACE is 32. If I do this instead: alert( onKeyPressEvent.keyChar + " " + dojo.keys.SPACE ); The result is: 32 So apparently the keyChar is "" in this case. How do I check to see whether the event is triggered by a space (Without cheating and just using 0) :) ? TIA, - Ole _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: [Event] Checking for dojo.keys.SPACE?Have you tried evt.charOrCode?
On Tue, Nov 10, 2009 at 11:25 AM, Ole Ersoy <ole.ersoy@...> wrote: Hi, _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: [Event] Checking for dojo.keys.SPACE?I tried this:
alert(onKeyPressEvent.charOrCode == " "); The result is true. The result is also true for this: alert(onKeyPressEvent.keyChar == " "); Thoughts? Thanks, - Ole On 11/09/2009 11:10 PM, Bill Keese wrote: > Have you tried evt.charOrCode? > > > On Tue, Nov 10, 2009 at 11:25 AM, Ole Ersoy <ole.ersoy@... > <mailto:ole.ersoy@...>> wrote: > > Hi, > > I'm capturing a key press event triggered by the space bar. I then > want to see whether it's the space bar, so I do this: > > alert( onKeyPressEvent.keyCode + " " + dojo.keys.SPACE ); > > The result is: > 0 32 > > So keyCode is 0 and dojo.keys.SPACE is 32. If I do this instead: > alert( onKeyPressEvent.keyChar + " " + dojo.keys.SPACE ); > > The result is: > 32 > > So apparently the keyChar is "" in this case. How do I check to see > whether the event is triggered by a space (Without cheating and just > using 0) :) ? > > TIA, > - Ole > _______________________________________________ > FAQ: http://dojotoolkit.org/support/faq > Book: http://docs.dojocampus.org > Dojo-interest@... > <mailto:Dojo-interest@...> > http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest > > > > > _______________________________________________ > FAQ: http://dojotoolkit.org/support/faq > Book: http://docs.dojocampus.org > Dojo-interest@... > http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: [Event] Checking for dojo.keys.SPACE?e.charOrCode == dojo.keys.SPACE
Ole Ersoy wrote: > I tried this: > > alert(onKeyPressEvent.charOrCode == " "); > > The result is true. The result is also true for this: > > alert(onKeyPressEvent.keyChar == " "); > > Thoughts? > > Thanks, > - Ole > > On 11/09/2009 11:10 PM, Bill Keese wrote: > >> Have you tried evt.charOrCode? >> >> >> On Tue, Nov 10, 2009 at 11:25 AM, Ole Ersoy <ole.ersoy@... >> <mailto:ole.ersoy@...>> wrote: >> >> Hi, >> >> I'm capturing a key press event triggered by the space bar. I then >> want to see whether it's the space bar, so I do this: >> >> alert( onKeyPressEvent.keyCode + " " + dojo.keys.SPACE ); >> >> The result is: >> 0 32 >> >> So keyCode is 0 and dojo.keys.SPACE is 32. If I do this instead: >> alert( onKeyPressEvent.keyChar + " " + dojo.keys.SPACE ); >> >> The result is: >> 32 >> >> So apparently the keyChar is "" in this case. How do I check to see >> whether the event is triggered by a space (Without cheating and just >> using 0) :) ? >> >> TIA, >> - Ole >> _______________________________________________ >> FAQ: http://dojotoolkit.org/support/faq >> Book: http://docs.dojocampus.org >> Dojo-interest@... >> <mailto:Dojo-interest@...> >> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest >> >> >> >> >> _______________________________________________ >> FAQ: http://dojotoolkit.org/support/faq >> Book: http://docs.dojocampus.org >> Dojo-interest@... >> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest >> > _______________________________________________ > FAQ: http://dojotoolkit.org/support/faq > Book: http://docs.dojocampus.org > Dojo-interest@... > http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest > > -- Peter E Higgins Dojo Project Lead : http://dojotoolkit.org _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: [Event] Checking for dojo.keys.SPACE?On 11/10/2009 09:37 AM, Peter E Higgins wrote: > e.charOrCode == dojo.keys.SPACE That is the source of my confusion: alert(dojo.keys.SPACE); >>> 32 alert(onKeyPressEvent.charOrCode == dojo.keys.SPACE); >>> false alert(onKeyPressEvent.keyCode) >>> 0 Is the dojo.keys.SPACE value wrong? Thanks, - Ole _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: [Event] Checking for dojo.keys.SPACE?Created a ticket:
http://bugs.dojotoolkit.org/ticket/10309 _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: [Event] Checking for dojo.keys.SPACE?Can you attach a test case to the ticket (and all tickets you file) using the "Attach file" button? Thanks.
On Wed, Nov 11, 2009 at 2:14 AM, Ole Ersoy <ole.ersoy@...> wrote: Created a ticket: _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: [Event] Checking for dojo.keys.SPACE?Done. Please Let me know if there's anything else that would be helpful.
Cheers, - Ole _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
|
|
Re: [Event] Checking for dojo.keys.SPACE?Looks like it's working to me...you want to be using charCode instead of keyCode, I think.
-Nathan On Nov 11, 2009, at 1:21 PM, Ole Ersoy wrote: > Done. Please Let me know if there's anything else that would be helpful. > > Cheers, > - Ole > _______________________________________________ > FAQ: http://dojotoolkit.org/support/faq > Book: http://docs.dojocampus.org > Dojo-interest@... > http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest _______________________________________________ FAQ: http://dojotoolkit.org/support/faq Book: http://docs.dojocampus.org Dojo-interest@... http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest |
| Free embeddable forum powered by Nabble | Forum Help |