[Proto-Scripty] query seems to keep returning
Hi, I've never had this problem with prototype before. I'm querying a twisted python web service that I wrote with a simple GET request, returning json, but for some reason the responseText always seems to be . function make_request() { debug(in make_request with url + url); new Ajax.Request(url, { method: get, onSuccess: function(transport) { debug(query successful); debug(response was ' + transport.responseText + '); }, onFailure: function(transport) { debug(query failed); } }); } In the browser I end up seeing * in make_request with url http://localhost:8000/route/?start=sta-917end=sta-10715starttime=1274469161 * query successful * response was '' And yet if I capture the traffic, the response looks fine. OPTIONS /route/?start=sta-917end=sta-10715starttime=1274469161 HTTP/ 1.1 Host: localhost:8000 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4) Gecko/ 20091206 Gentoo Firefox/3.5.4 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/ *;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Origin: null Access-Control-Request-Method: GET Access-Control-Request-Headers: x-prototype-version,x-requested-with HTTP/1.1 200 OK Content-Length: 65 Content-Type: application/json {status: defer, reason: No workers ready, try again soon} So why am I not seeing it in transport.responseText ? Thanks, Mike -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] new class instance and string is not a function error
Hi group I tried to store a list of Class and fetch those class definition to create new instance in the following way: myclasses = { A: Class.create({...}), B: Class.create({...} ... }; ... for (var i = 0; i myclasses.length; ++i) { var cls = myclasses[i]; var obj = new cls(...); } Unfortunately the above code failed at var obj = new cls(...); and it throws out the exception: string is not a function. Do you have any idea? Thx, Green -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Blur, Focus, Event Delegation
Not sure if this is a bug report, feature request, help request, or even just a complaint about the state of the world :) Using Prototype 1.7 rc2, I have been exploring event delegation with the new Element#on functionality, using the css selector filter. My initial tests with click (and dblclick) events worked fine, but when I moved on to blur and focus, things broke. The blur and focus events work fine as long as the the '.on' is for the actual (in my sample) input fields, but the events do not trigger (bubble) if I set the handler on an ancestor element. It is *possible* to get the functionality (bubbling) to work, by bypassing some of the prototype functionality, using .addEventListener (for most browsers), and .observe with 'focusin' and 'focusout' events (for IE). (I found a sample for that at http://www.ruby-forum.com/topic/159048, tried a variation of the code at http://pastie.org/pastes/186221). That though falls back on the old techniques, where the handler needs do something like findElement to figure out what the 'requested' event should be associated with. So: Is there a way to get $(ele).on( some_event, css_selector ) ... to trigger for blur and focus events on descendant elements of ele with rc2? Is that 'intended' to work with the latest code, since it is supposed to provide first-class support for event delegation? The 'basic' code I am trying to use is: DelegationExplorer.start( ele, 'click', '.special' ); DelegationExplorer.start( ele, 'dblclick', '.special' ); DelegationExplorer.start( ele, 'blur', '.special' ); DelegationExplorer.start( ele, 'focus', '.special' ); ... start: function(){ ... this.handlers[localEvn][eleId] = $(eleId).on( localEvn, localSel, function( triggerEvent, matchElement ) { DelegationExplorer.genericHandler( triggerEvent, matchElement ); }); were ele is an ancestor of an input field [type=text or textarea]. I have debug / introspection / reporting code in genericHandler to tell which events are getting through. Click and dblclick get reported, blur and focus do not. Using: this.handlers[localEvn][eleId] = $(eleId).on( localEvn, function( triggerEvent, matchElement ) { DelegationExplorer.directHandler( triggerEvent, matchElement ); }); triggers just fine, when eleId is the actual input field. The 'fudge' to get [most of] the functionality (without the css filter) is: var myRoot = $('frm'); if( myRoot.addEventListener ) { myRoot.addEventListener( 'focus', DelegationExplorer.directHandler, true ); myRoot.addEventListener( 'blur', DelegationExplorer.directHandler, true ); } else { // IE supports focusin and focusout myRoot.observe( 'focusin', DelegationExplorer.directHandler ); myRoot.observe( 'focusout', DelegationExplorer.directHandler ); } where frm is again an ancestor of the input fields -- mMerlin -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: new class instance and string is not a function error
I found the problem. It's not caused by class array actually. The following code demonstrate what I was trying to do: var A = Class.create(...); var B = Class.create(...); Object.extend(B, { A_ext: Class.create(A, {...}), A_list: { A1: Class.create(B.A_ext, {...}), A2: Class.create(B.A_ext, {...}) } }); The problem of above code is that when it try to reference B.A_ext, which has not been initialized yet. And splitting the Object.extend(B to 2 extend actions solves the problem: Object.extend(B, {A_ext: Class.create(A, {...}}); // now that B.A_ext has been initialized, we can use it safely Object.extend(B, { A_list: { A1: Class.create(B.A_ext, {...}), A2: Class.create(B.A_ext, {...}) } }); On Thu, May 27, 2010 at 11:07 AM, green greenlaw...@gmail.com wrote: Hi group I tried to store a list of Class and fetch those class definition to create new instance in the following way: myclasses = { A: Class.create({...}), B: Class.create({...} ... }; ... for (var i = 0; i myclasses.length; ++i) { var cls = myclasses[i]; var obj = new cls(...); } Unfortunately the above code failed at var obj = new cls(...); and it throws out the exception: string is not a function. Do you have any idea? Thx, Green -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] Re: query seems to keep returning
On 26/05/10 T.J. Crowder said: To allow this, you'd want your server to respond with these headers: Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET Access-Control-Allow-Headers: x-prototype-version,x-requested-with So just to see if this worked, I added support for an OPTIONS request, and responded with the above. It did work in that the browser did follow up with a GET request, and my server sent the response as content-type application/json. Unfortunately it hasn't helped my situation as the transport.responseText is still empty. This is my new trace: OPTIONS /route/?start=sta-917end=sta-10715starttime=1274469161 HTTP/1.1 Host: localhost:8000 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100401 Ubuntu/9.10 (karmic) Firefox/3.5.9 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Origin: null Access-Control-Request-Method: GET Access-Control-Request-Headers: x-prototype-version,x-requested-with HTTP/1.1 200 OK Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET Access-Control-Allow-Headers: x-prototype-version,x-requested-with Content-Length: 0 GET /route/?start=sta-917end=sta-10715starttime=1274469161 HTTP/1.1 Host: localhost:8000 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100401 Ubuntu/9.10 (karmic) Firefox/3.5.9 Accept: application/json Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive X-Requested-With: XMLHttpRequest X-Prototype-Version: 1.6.1 Origin: null HTTP/1.1 200 OK Content-Length: 76 Content-Type: application/json { reason: No workers ready, try again soon, status: defer } Any idea why the responseText would still come back empty? Thanks, Mike -- Michael P. Soulier msoul...@digitaltorque.ca Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction. --Albert Einstein signature.asc Description: Digital signature