Help Logs Database

Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Ircnet  |  Dalnet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13

<thefat> Is it possible to create and return POST data to an xmlhttprequest function and then access that post data?
<thefat> that's a silly idea isnt it
<jgarbers> thefat: no... that sounds reasonable, unless i'm missing what you mean
<thefat> jgarbers: you can create POST or GET data and sent it to the server via the xmlhttprequest object
<jgarbers> yes, i'm doing that in my app
<thefat> I was wondering if you can send it back as an alternative to XML/JSON
<jgarbers> sure. you can return anything you want.
<thefat> oooh
<jgarbers> doesn't have to be XML.
<jgarbers> i started mine out just returning "OK" or "ERR" or stuff like that
<thefat> yea, I know... I just figured that POST data would be a better way to p*** the data
<jgarbers> but eventually went with an XML response so i could carry a richer payload.
<jgarbers> oh. you mean sending POST data *back* to the javascript?
<frb> just got js to tell flash an arbitrary URL to load
<thefat> jgarbers: yes
<thefat> jgarbers: I don't like XML because you have to do too much character encoding or else it complains
<jgarbers> well, i think you were right. that doesn't make sense. ;-)
<jgarbers> oh. you mean POST-formatted data.
<frb> I don't use XML because it's too much data
<jgarbers> there *is* a lot of "packing material" in an XML document. it's the binary equivalent of styrofoam peanuts.
<thefat> right. When the client makes a request it makes it with GET or POST or HEAD at the top.. but the server doesnt send those headers and I don't guess there are functions for sending back POST data...
<jgarbers> on the other hand i'm trying to teach myself not to worry about a K here and a K there any more.
<thefat> jgarbers: hehe
<ryan_> how can i get the key that was pressed when a certain <input > has focus and say i press the enter key while it does. i was thinking ONKEYDOWN="if(event.KeyCode==13){ return false; }" but this yields not luck. i would like to inercept any carrage returns so my form will not submit upon pressing the Enter key. thx
<frb> ****ing IE
<thefat> ryan: try onKeyUp
<thefat> or onKeyPress
<ryan_> will do
<thefat> it makes a difference
<frb> ie gecko, I was using window.document.elementname to get a ref to the actual functional part of the flash player
<frb> in IE, that doesn't work
<frb> neither does getElementsByTagName("embed")[0]
<frb> gEBI gives me a nodeRef for the object tag containing the flash app
<thefat> frb: have you looked at the object's properties?
<thefat> may give you some ideas..
<frb> I keep having this problem with Object tags
<frb> the MS script debugger leaves a lot to be desired
<thefat> Heh, the script debugger makes my MSIE crash
<ryan_> thefat: no luck there
<ryan_> i added the following if(event.keycode==13){return false;}
<thefat> oh wait
<thefat> ryan: if(event.keyCode==13) event.preventDefault();
<thefat> is that what you wanted?
<ryan_> when the user hits enter, i would liek the form to not submit
<thefat> that's what you want then
<thefat> it will supress the enter key
<ryan_> allright, ill give that a shot. much appreciated
<thefat> preventDefault supressed the default action
<frb> ok, that is insane
<frb> doc.gEBI('movie') returns a Node that contains an Object tag
<frb> window.document.movie returns a binary object ref that I can call commands on
<frb> but it doesn't work unless the <object> tag has an ID
<thefat> frb: don't try to understand it ;)
<frito> ryan, you should probably also use: if (event.keyCode == event.DOM_VK_RETURN)
<frb> window.document.foo feels wrong to me though
<ryan_> instead of the ascii value?
<frito> yea, DOM_VK_RETURN is 13
<thefat> frito: is that in case of different character encoding?
<ryan_> i tried this for the first input field in the form
<ryan_> OnKeyUp="if(event.keycode==13){event.preventDefault();}" OnKeyPress="if(event.keycode==13){event.preventDefault();}" OnKeyDown="if(event.keycode==13){event.preventDefault();}" OnKeyUp="if(event.keycode==13){event.preventDefault();}"
<ryan_> this isn't preventing the carriage return from submitting
<thefat> woo
<ryan_> i put focus on that field and hit enter, the form submits.
<ryan_> it seems like the condition is not being met for some unusual reason
<ryan_> ok
<ryan_> event.which works in firefox
<ryan_> but
<ryan_> event.keycode does not work in IE, .which does not work in IE either
<frb> it's keyCode iirc
<ryan_> somone /slap me
<ryan_> nvm its not a case sensitive issue
<ryan_> hmm
<frb> definitely keyCode on IE
<ryan_> but yoru right it should be keyCode
<frb> and it's a Unicode character
<frb> dunno if that changes the value or not
<thefat> has anyone experienced style weirdness when using insertBefore?
<thefat> margins breaking..
<ryan_> ok
<ryan_> it stops the first carriage return in IE now, but none thereafter. lol
<frb> event.keyCode seems to work on FF as well, but it's probably undocumented
<factor> yeah I use keycode on FF. works great.
<frb> I haven't even read the dom event model since I can never use it
<factor> heh
<frito> ryan_, this seems to work in both IE and FF: <input type="text" name="hi" onkeypress="return (event.keyCode != 13);"/>
<ryan_> if it does
<ryan_> i love u
<ryan_> lol
<frito> it seems IE doesn't support that constant i put up there
<ryan_> agreed
<frb> `ie
<RTFS> ie: non standards-compliant, buggy, evil little browser. a pox on it.
<ryan_> yes
<ryan_> thank you very much frito , you saved me a few hours
<ryan_> id buy you a beer if you lived close :)
<frito> maybe i do
<ryan_> ur in philli?
<frito> what a coincidence!
<ryan_> hehe
<frito> i live nowhere near there
<thefat> info
<thefat> wrong channel
<tieTYT> hello
<tieTYT> i'm comparing 2 textboxes in a form but it's comparing them as strings so 10 < 4
<tieTYT> how do I fix this?
<brainy> cast them to numbers... see http://xkr.us/articles/javascript/unary-add/
<tieTYT> thanks
<frb> unary add is evil
<frb> just use parseInt and make your code clean
<tieTYT> there's a parse int?
<tieTYT> i was looking for that
<tieTYT> frb: where is it? I don't see it in the w3schools reference
<tieTYT> is it in the string object?
<frb> parseInt is part of the js core language
<tieTYT> frb: oh ok
<Welly> Hey all.. i'm trying to create some event listeners for some links.. currently it looks like <a onclick="return confirm('Are you sure you wish to delete this?');" href="delete.php?id=1">
<Welly> I could have a number of those
<frb> there's also a parseFloat
<Welly> how could I create multiple onclick event listeners?
<frb> what do you mean?
<Welly> ok.. if i give that one an id - deleteItem - deleteItem.onclick = deletefunction;
<baldukai> what happens when i take a link (a href) and add an onclick event? is the onclick event executed before the link redirection?
<Welly> and then my deletefunction will do the business
<Welly> baldukai, it is yep
<baldukai> Welly: cool thanks!
<frb> it's safest to not use both
<Welly> yeah
<Welly> i'm going to remove the onclick event from the A tag
<frb> who knows what IE will do tomorrow
<Welly> but the problem is i don't know how many of those A tags I'll have
<Welly> i need to set up some event listeners for them
<efkoj> from an xml file i get -2 now i have this as a string how can i cast it to an int?
<efkoj> so i can do 3-2 ?
<frb> so put them all in a contianer, then get a ref to the container, and use containerref.getElementsByTagName("a")
<Welly> oh ok.. cool
<Welly> good thinking batman! cheers for that :)
<frb> and on that, you can either use .onclick = something, or the more useful method of using attachEvent IE, or addEventListener DOM
<Welly> how are they more useful? i'm fairly new to this
<nmatrix9> Welly: ever see Batman Begins?
<Welly> nmatrix9: i've not actually
<Welly> is it good?
<frb> Welly: with the attachEvent and addEventListener functions, you can add more than one handler
<nmatrix9> so I've heard
<Welly> frb: ahh ok.. i get you.. oh right.. well in this instance I only need to do one thing but i'll have a look into those for future reference
<frb> it's useful for me because our designers throw things in body onload="..."
<frb> if I want to add, I use the attachEvent/addEventListener to make my stuff go as well as theirs
<efkoj> somebody?
<frb> efkoj: parseInt(string) or parseInt(string, base)


Return to javascript
or
Go to some related logs:

eurochat
suse vid_restart
politics

Copyright © 2005 www.irclogs.ws. All rights reserved. » disclaimer » contact