[fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Felipe Monteiro de Carvalho
Hello, I am trying to send data from javascript and read data back from my cgi module with this: SendSyncRequest = function(RequestURL, RequestContent) { var request = new XMLHttpRequest(); request.open('GET', RequestURL, false); request.setRequestHeader('Content-Type',

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Michael Van Canneyt
On Mon, 17 Oct 2011, Felipe Monteiro de Carvalho wrote: Hello, I am trying to send data from javascript and read data back from my cgi module with this: SendSyncRequest = function(RequestURL, RequestContent) { var request = new XMLHttpRequest(); request.open('GET', RequestURL,

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Felipe Monteiro de Carvalho
On Mon, Oct 17, 2011 at 3:55 PM, Michael Van Canneyt mich...@freepascal.org wrote: As far as I know, this will always be empty, for the simple reason that the request is executed asynchronously. You must attach a callback which is executed once the request is ready, and read ResponseText after

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Michael Van Canneyt
On Mon, 17 Oct 2011, Felipe Monteiro de Carvalho wrote: On Mon, Oct 17, 2011 at 3:55 PM, Michael Van Canneyt mich...@freepascal.org wrote: As far as I know, this will always be empty, for the simple reason that the request is executed asynchronously. You must attach a callback which is

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Felipe Monteiro de Carvalho
On Mon, Oct 17, 2011 at 4:01 PM, Michael Van Canneyt mich...@freepascal.org wrote: ? AFAIK xhttprequest is never synchronous... It is synchronous if the third parameter of open is set to false: http://www.w3.org/TR/XMLHttpRequest/#the-open-method client . open(method, url, async, user,

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Michael Van Canneyt
On Mon, 17 Oct 2011, Felipe Monteiro de Carvalho wrote: On Mon, Oct 17, 2011 at 4:01 PM, Michael Van Canneyt mich...@freepascal.org wrote: ? AFAIK xhttprequest is never synchronous... It is synchronous if the third parameter of open is set to false:

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Felipe Monteiro de Carvalho
On Mon, Oct 17, 2011 at 4:11 PM, Michael Van Canneyt mich...@freepascal.org wrote: Ehm. I think that the problem is elsewhere. Content is only accepted with the POST method. Why? Is this a limitation from HTTP? If I change to POST then I can no longer select my module, neither ?module=MainPage

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Michael Van Canneyt
On Mon, 17 Oct 2011, Felipe Monteiro de Carvalho wrote: On Mon, Oct 17, 2011 at 4:11 PM, Michael Van Canneyt mich...@freepascal.org wrote: Ehm. I think that the problem is elsewhere. Content is only accepted with the POST method. Why? Is this a limitation from HTTP? Yes. If I change

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Felipe Monteiro de Carvalho
On Mon, Oct 17, 2011 at 4:33 PM, Michael Van Canneyt mich...@freepascal.org wrote: Yes. I see ... simply encoding the data differently from what I originally wanted and feeding it to a GET field worked fine. You must specify an action. A single path component is treated as an action.

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Michael Van Canneyt
On Mon, 17 Oct 2011, Felipe Monteiro de Carvalho wrote: On Mon, Oct 17, 2011 at 4:33 PM, Michael Van Canneyt mich...@freepascal.org wrote: Yes. I see ... simply encoding the data differently from what I originally wanted and feeding it to a GET field worked fine. Also a solution :-)