[Proto-Scripty] Re: AJAX Request: receive base64 encoded image in responseText

2012-08-16 Thread Victor
Is response empty in network sniffer/web inspector? Or in javascript code? The response is already empty in web inspector. Very bad You should check if it is actually written to HTTP response (maybe response is already flushed). If I return some HTML in addition to my base64 string

[Proto-Scripty] Re: AJAX Request: receive base64 encoded image in responseText

2012-08-15 Thread Victor
I checked the response header and it's Content-Type: text/html; charset=UTF-8. Unfortunately I couldn't check the response because it's empty. Is response empty in network sniffer/web inspector? Or in javascript code? Printing the return-part in my controller I got the correct

[Proto-Scripty] Re: AJAX Request: receive base64 encoded image in responseText

2012-08-15 Thread mabei
Dear Victor, Am Mittwoch, 15. August 2012 11:47:25 UTC+2 schrieb Victor: I checked the response header and it's Content-Type: text/html; charset=UTF-8. Unfortunately I couldn't check the response because it's empty. Is response empty in network sniffer/web inspector? Or in javascript

[Proto-Scripty] Re: AJAX Request: receive base64 encoded image in responseText

2012-08-14 Thread mabei
Dear Victor, thanks for your reply. I checked the response header and it's Content-Type: text/html; charset=UTF-8. Unfortunately I couldn't check the response because it's empty. Printing the return-part in my controller I got the correct base64-encoded string. I checked prototype api docs and

[Proto-Scripty] Re: AJAX Request: receive base64 encoded image in responseText

2012-08-14 Thread mabei
Additional info: when I print out the response to console I only receive: *img src='data:image/jpeg;base64,' width='262'/* So my base64-encoded string is cutted out. When calling my reloadurl directly in the browser the image shows up correctly. Any further suggestions to this? regards mabei

[Proto-Scripty] Re: ajax request no works on Chrome - decoding fails

2010-11-11 Thread T.J. Crowder
Hi, It's T.J., not J. i want convert requestObject in JSON string and send to the server.  var jsonRequest         = encodeURIComponent(JSON.stringify(requestObject)); new Ajax.Request(baseUrl + '/usermsg/index/sendmessage', {             method:     'POST',             requestHeaders:

[Proto-Scripty] Re: ajax request no works on Chrome - decoding fails

2010-11-11 Thread fashionpeople
Hi T.J. Crowder, var jsonRequest = JSON.stringify(requestObject); new Ajax.Request(baseUrl + '/usermsg/index/sendmessage', { method: 'POST', requestHeaders: {Accept: 'application/json'}, parameters: {json: jsonRequest}, // ... In PHP: $request = $this-getRequest();

Re: [Proto-Scripty] Re: ajax request no works on Chrome - decoding fails

2010-11-11 Thread Walter Lee Davis
On Nov 11, 2010, at 8:20 AM, fashionpeople wrote: Hi T.J. Crowder, var jsonRequest = JSON.stringify(requestObject); new Ajax.Request(baseUrl + '/usermsg/index/sendmessage', { method: 'POST', requestHeaders: {Accept: 'application/json'}, parameters: {json: jsonRequest}, // ... In

[Proto-Scripty] Re: ajax request no works on Chrome - decoding fails

2010-11-11 Thread fashionpeople
Hi T.J. Crowder, Now works with your suggests. Thanks a lot. The ajax request look like doesn't work, because callback parse, it did call another ajax request not fixed with your suggets. Thanks. On 11 Nov, 15:43, Walter Lee Davis wa...@wdstudio.com wrote: On Nov 11, 2010, at 8:20 AM,

[Proto-Scripty] Re: ajax request no works on Chrome - decoding fails

2010-11-10 Thread T.J. Crowder
Hi, I tried use fixedEncodeURI like suggest in your links. I've never even heard of fixedEncodeURI. People are taking the time to help you here, it's worth taking the time to carefully *read* what people have written and try the things they suggest (or not, of course, it's up to you). This is

[Proto-Scripty] Re: ajax request no works on Chrome - decoding fails

2010-11-10 Thread Eric
It may be helping if you could trace and post here the following things : From Javascript: - requestObject - JSON.stringify(requestObject) From PHP: - $this-getRequest()-getRawBody(); - rawurldecode($this-getRequest()-getRawBody()); Also, why do you need to use JSON.stringify thing when, as T.J.

[Proto-Scripty] Re: ajax request no works on Chrome - decoding fails

2010-11-10 Thread fashionpeople
J. Crowder do not get me wrong, I thank you for the effort they put in helping others. i readed about your suggest to send data in this simple way: var jsonRequest = ...; new Ajax.Request( // ... parameters: {json: jsonRequest} // ... }); but my question is, i have

[Proto-Scripty] Re: ajax request no works on Chrome - decoding fails

2010-11-09 Thread fashionpeople
Hi, I replaced escape with encodeURI. But decoding fails again. function sendMessage(baseUrl, idNickRcv, msg) { var requestObject = new Object(); requestObject.idNickRcv = idNickRcv; requestObject.msg = msg; var jsonRequest =

[Proto-Scripty] Re: ajax request no works on Chrome - decoding fails

2010-11-09 Thread T.J. Crowder
Hi, I replaced escape with encodeURI. But decoding fails again. Well, did you try actually doing what I suggested? -- T.J. On Nov 9, 4:07 pm, fashionpeople fashionpeople.busin...@gmail.com wrote: Hi, I replaced escape with encodeURI. But decoding fails again.    function

[Proto-Scripty] Re: ajax request no works on Chrome - decoding fails

2010-11-09 Thread fashionpeople
Hi, I replaced escape with encodeURI. But decoding fails again. function sendMessage(baseUrl, idNickRcv, msg) { var requestObject = new Object(); requestObject.idNickRcv = idNickRcv; requestObject.msg = msg; var jsonRequest =

[Proto-Scripty] Re: ajax request no works on Chrome - decoding fails

2010-11-09 Thread fashionpeople
I tried use fixedEncodeURI like suggest in your links. But doesn't work. I didn't understand the problem. On 9 Nov, 17:25, T.J. Crowder t...@crowdersoftware.com wrote: Hi, I replaced escape with encodeURI. But decoding fails again. Well, did you try actually doing what I suggested? --

[Proto-Scripty] Re: ajax request no works on Chrome - decoding fails

2010-11-08 Thread T.J. Crowder
Hi, I don't know that it's the problem because I'm not a PHP person, but you're using the `escape` function to encode your parameters, and then decoding them with a PHP function called `urldecode`. JavaScript's `escape` function does _not_ URL-encode things, it does something similar but

Re: [Proto-Scripty] Re: ajax request no works on Chrome - decoding fails

2010-11-08 Thread Walter Lee Davis
Right. The best low-level way to translate JS to PHP and back again is using encodeURI or uncodeURIComponent on your JS side, and rawurldecode() or rawurlencode() on the PHP side. They are functionally identical, as long as you have set your PHP side to use UTF-8 as its default charset.

[Proto-Scripty] Re: Ajax request on anchor onclick is buggy in Safari

2010-08-12 Thread Eric
T.J., I was surprised too that the DB would have time to get an update before the page is unloaded, but I had a closer look at the example :o) If the links urls are downloadable file types like the .exe of the example, the browser will not unload the current page, and the Ajax request will

[Proto-Scripty] Re: Ajax request on anchor onclick is buggy in Safari

2010-08-10 Thread Fabien Ménager
Your method seems really random. You should proceed differently. Imagine the user has JS disabled, it's click won't be logged, you should use a server side script that will log the click and redirect the user to the desired file : href=dispatcher.php?file=program.exe If you don't have access to

[Proto-Scripty] Re: Ajax request on anchor onclick is buggy in Safari

2010-08-10 Thread T.J. Crowder
Hi, By default, Ajax.Request is *asynchronous*. I'm surprised, frankly, that you're seeing many database updates at all, regardless of the browser, since a request may not have been transmitted before the page gets torn down to make way for the new one. I wouldn't expect it to be reliable. If

[Proto-Scripty] Re: Ajax Request PDF to IFRAME

2010-02-11 Thread kstubs
Well thanks for the help on posting a request to the iframe to handle the PDF. Here is my bigger problem and the reason for my original thought: how do you trigger code on completion of the PDF load in the iframe? Of course the original thought was to make an ajax request and and write the results

Re: [Proto-Scripty] Re: Ajax Request PDF to IFRAME

2010-02-09 Thread Peter De Berdt
Generate a form with the necessary values in the iFrame and submit the form. That's all I can think off right now. On 09 Feb 2010, at 01:03, kstubs wrote: It must be a post to the server, not a get. On Feb 8, 4:22 pm, T.J. Crowder t...@crowdersoftware.com wrote: Hi, Is this possible?

[Proto-Scripty] Re: Ajax Request PDF to IFRAME

2010-02-09 Thread T.J. Crowder
Hi, It must be a post to the server, not a get. Okay, that's a *few* more lines of code: var markup, form; markup = form id='___unique_form_id___' + method='POST' + action='yoururl' + target='theIFrameName' + style='display:

[Proto-Scripty] Re: Ajax Request PDF to IFRAME

2010-02-09 Thread T.J. Crowder
Blast (I *hate* double posting), forgot to say: By theIFrameName in that code I mean literally the value of a `name` attribute on the `iframe` tag (*name*, not *id*). -- T.J. :-) On Feb 9, 3:05 pm, T.J. Crowder t...@crowdersoftware.com wrote: Hi, It must be a post to the server, not a get.

[Proto-Scripty] Re: Ajax Request PDF to IFRAME

2010-02-08 Thread T.J. Crowder
Hi, Is this possible? Possible? It's downright easy: $('idOfIFrame').src = pathToYourServerScript.xyz; Very important that your server script set the correct content type, of course. I use something similar with a frame (not an iframe), but the concept should be transferrable. HTH, --

[Proto-Scripty] Re: Ajax Request PDF to IFRAME

2010-02-08 Thread kstubs
It must be a post to the server, not a get. On Feb 8, 4:22 pm, T.J. Crowder t...@crowdersoftware.com wrote: Hi, Is this possible? Possible? It's downright easy:     $('idOfIFrame').src = pathToYourServerScript.xyz; Very important that your server script set the correct content type, of

[Proto-Scripty] Re: ajax request

2009-11-10 Thread Alex McAuley
Could be the web server ... Alot of web servers have a max number of paralell requests per user Alex Mcauley http://www.thevacancymarket.com - Original Message - From: ziva znibers...@gmail.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Tuesday,

[Proto-Scripty] Re: ajax request

2009-11-10 Thread T.J. Crowder
Hi, Nearly identical questions at almost the same time. :-) Here's the other one, where I've posted an answer: http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/6af62cd45d76f06e HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / com

[Proto-Scripty] Re: ajax request

2009-11-10 Thread Alex McAuley
: [Proto-Scripty] Re: ajax request Hi, Nearly identical questions at almost the same time. :-) Here's the other one, where I've posted an answer: http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/6af62cd45d76f06e HTH, -- T.J. Crowder Independent Software Consultant tj

[Proto-Scripty] Re: Ajax Request Timeout

2009-07-15 Thread Rick
@Matt Foster: your patch didn't work for me ?? in ff i didn't get the onTimeout event or if you get then it happend when the server is back online an the as often as it should happend while the offline time. i don't know why? i use an PeriodicalExecuter for my ajax request ... that's

[Proto-Scripty] Re: Ajax Request Timeout

2009-07-14 Thread Rick
hi But leaving aside status 0, just a logical point.  The third condition in your updated code:     return (status = 200 status 300 status != 0); ...is irrelevant and will never be evaluated.  If 200 = x 300, x cannot be zero. i can't believe what piece rubbish of code i

[Proto-Scripty] Re: Ajax Request Timeout

2009-07-14 Thread Matt Foster
Hey Rick, My proposed idea in that article requires you to actually redefine the Ajax.Request. If we can solidify the idea we could submit the code as a patch to core but as of now you've gotta either replace it in the source library itself or just redefine it after the library but before

[Proto-Scripty] Re: Ajax Request Timeout

2009-07-14 Thread Matt Foster
Yeah I discuss the idea of having its own event for timing out in my article. The argument is a timeout is a failure, its failed to retrieve a response in the given time. So a timeout is basically like an inherited event from onFailure. Question remains do you seperate the event or just add a

[Proto-Scripty] Re: AJAX request - select element

2009-06-16 Thread fufolewe
Hi, thx a lot for your help. @Colin doesn't work means it returns NULL ;) But of course, you are right. I already feared that the A string is not a document/DOM is the main problem. @T.J. Crowder thx! I'll try this soon, it looks promising :) I already created a regEx solution but it's too

[Proto-Scripty] Re: AJAX request - select element

2009-06-16 Thread Alex McAuley
: [Proto-Scripty] Re: AJAX request - select element Hi, thx a lot for your help. @Colin doesn't work means it returns NULL ;) But of course, you are right. I already feared that the A string is not a document/DOM is the main problem. @T.J. Crowder thx! I'll try this soon, it looks promising

[Proto-Scripty] Re: AJAX request - select element

2009-06-16 Thread ColinFine
On Jun 15, 1:41 pm, T.J. Crowder t...@crowdersoftware.com wrote: 2. Alternately, use a document fragment[1][2].  This is to a large extent what document fragments are for -- holding copies of things and mucking about with them off-to-the-side.  I was surprised not to have an example lying

[Proto-Scripty] Re: AJAX request - select element

2009-06-15 Thread T.J. Crowder
Hi, As Colin points out, you're trying to treat a String object like a Document (by calling getElementById), which isn't going to work. You have a couple of options. 1. Use string parsing to isolate the markup in that string for the element you want. Once you have just that markup, you can

[Proto-Scripty] Re: AJAX request to XML-RPC webservice

2009-05-20 Thread T.J. Crowder
Hi, You're running into something called the Same Origin Policy, details here.[1] Basically, you can't use the XmlHttpRequest object to request resources from a different origin than the page in which the script is running, and origin includes the port. [1]

[Proto-Scripty] Re: Ajax request doesn't work on some computers?

2009-04-07 Thread Walter Lee Davis
Is there a reason why you are using complete URLs in your call? var categoriesInitUrl = 'http://www.tonerize.com/catalog/picker/categories/' ; You might get better mileage by making these relative URLs. var categoriesInitUrl = '/catalog/picker/categories/'; Walter On Apr 7, 2009, at 10:52

[Proto-Scripty] Re: Ajax request doesn't work on some computers?

2009-04-07 Thread T.J. Crowder
Hi, However on some computers the request is never even sent, and we can't figure out why. Have you eliminated things like what brand of browser they're using, etc.? Walter's point about the URL well-taken, and I see that you've already fixed it for the bit he mentioned. That's a good idea,

[Proto-Scripty] Re: Ajax request doesn't work on some computers?

2009-04-07 Thread Yaron
Wow you were right that was exactly the issue. I know you can't use Ajax cross-domain but I had no idea that putting in the full URL would cause problems. It was also very strange because it only happened on certain computers / browsers. Regardless, thanks so much for your help! On Apr 7, 1:27 

[Proto-Scripty] Re: Ajax request doesn't work on some computers?

2009-04-07 Thread T.J. Crowder
Hi, Sorry, sent too soon. When I said aren't the same thing, I mean in terms of the Same Origin Policy[1]. [1] http://en.wikipedia.org/wiki/Same_origin_policy HTH, -- T.J. On Apr 7, 7:00 pm, T.J. Crowder t...@crowdersoftware.com wrote: Hi, However on some computers the request is never

[Proto-Scripty] Re: Ajax request doesn't work on some computers?

2009-04-07 Thread Yaron
TJ, thanks for you indepth reply and the link to the Wiki post. Point well taken from both you and Walter. One thing I will definitely do before anything else is redirect tonerize.com to www.tonerize.com, so that I can alleviate any of these issues before I make all of the calls relative! Thanks

[Proto-Scripty] Re: Ajax request Encoding issue iso-8859-1

2008-11-25 Thread Walter Lee Davis
If you read the Prototype documentation, you will see that Prototype uses UTF-8 internally, and if you read the W3C recommendations, you will see that UTF-8 is the preferred and expected encoding for Web sites. So what is your issue specifically? Are you unable to set your server to

[Proto-Scripty] Re: Ajax request encoding

2008-10-22 Thread João Paulo Mafra
Hi Baglan, I'm already doing that. However, in the server I must convert from one charset to another programmaticaly. The problem seems to be the use of encodeURIComponent function by prototype: Mozilla Developer Core Javascript

[Proto-Scripty] Re: Ajax request encoding

2008-10-22 Thread João Paulo Mafra
(I'm resending my last message in plain text after viewing it on google groups, which is in html and with formatting errors) Hi Baglan, I'm already doing that. However, in the server I must convert from one charset to another programmaticaly. The problem seems to be the use of