phphtmlhaxeopenfl

unable to get php server response into html5 OpenFL haxe app


I have a json string being printed using Lib.print(string); in haxe/php and am hosting that on my localhost

I've checked http://localhost/index.php, and it does indeed print the json object as text.

My HTML5 app has the following code in it

var h = new HttpJs('http://localhost/index.php');

function traceFunc (d:String){trace(d); }
h.onData = traceFunc; 
h.onError = traceFunc;

This has yet to come back with an onData response (or onError for that matter). I know I have to be missing something simple.


Solution

  • It seems like you forgot to actually invoke the request?

    h.request(false);
    

    (using false for the post argument to make sure it's a GET instead of a POST request)