Hi

Is there a reason you're using qx.io.request.*?  I think that's an older
treatment.  You could try using qx.io.remote.Request; here's an example from
one of my contribs:

> var req = new qx.io.remote.Request("test.php", "POST", "text/plain");
>       req.setAsynchronous(false);
>       req.setData(text);
> 
> // You must set the character encoding explicitly; even if the page is served
> as UTF8 and everything else is
>       //  UTF8, not specifying will lead to the server screwing up decoding
> (presumably the default charset for the
>       //  JVM).
>       var charset = document.characterSet || document.charset || "UTF-8";
>       req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;
> charset=" + charset);
> 
>       // Send it
> req.addListener("completed", this._processResponse, this);
>       req.addListener("failed", this._processResponse, this);
>       req.addListener("timeout", this._processResponse, this);
> req.send();

And this._processResponse looks like this:

    _processResponse : function(evt) {

      var txt = evt.getContent();

      var statusCode = evt.getStatusCode();



      if (statusCode == 200) {

// ... handle data



      } else {

      this.error("Error returned by server, code=" + statusCode);

      }

    },


John


On 13/03/2014 09:19, "jarous92" <hlochjaro...@seznam.cz> wrote:

> Hello,
> I try to write desktop application, which needed to communicate with
> database. But if I send a xhr request to php file, message error will
> occurs.
> 
> Here is the code:
> 
> forward.addListener("execute", function() {
>         var termin_od = datum_od.getValue().getFullYear() + "-" +
> (datum_od.getValue().getMonth()+1) + "-" + datum_od.getValue().getDate();
>         var termin_do = datum_do.getValue().getFullYear() + "-" +
> (datum_do.getValue().getMonth()+1) + "-" + datum_do.getValue().getDate();
>         if (datum_od.getValue() >= datum_do.getValue()) {
>             alert("Doba pobytu musí být alespoň 2 dny!");
>           } else {
>               var xmlhttp = new qx.io.request.Xhr("test.php", "POST");
>               xmlhttp.setRequestHeader("Content-type",
> "application/x-www-form-urlencoded");
>               xmlhttp.setRequestData("test=someData");
>               xmlhttp.send();
>               
>               xmlhttp.addListener("error", function(e) {
>                   alert("Error!!");
>                 }, this);
>                 
>               }
>       }, this);
> 
> In PHP file I try to approach by $_POST['test'].
> 
> I develope the desktop application at localhost (xampp). Please, how
> correctly send a POST requests to php files?
> 
> Thank you!
> 
> 
> 
> --
> View this message in context:
> http://qooxdoo.678.n2.nabble.com/Using-Xhr-object-in-Desktop-application-tp758
> 5438.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
> 
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to