Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hello , I am not able to have ccbDoHTTPRequest working with webgl despite trying more and more this is the code inside CC function finishedRequest(data) { var s = ccbGetSceneNodeFromName("punti"); ccbSetSceneNodeProperty(s, "Text",data); } ccbDoHTTPRequest("http://www.xxx.com/index2.php", finishedRequest); this is the php code <?php $file = fopen("test3.txt","w"); echo fwrite($file,"Hello World. Testing!"); fclose($file); echo('1234'); //Create a stdClass instance to hold important information //$return = new stdClass(); //$return->success = true; //$return->errorMessage = ""; //$return->data = array(); //Assign the altered data to a property of $return //$return->data['test'] = 'test'; //Encode the stdClass object containing information and return data as //a json string //$json = json_encode($return); //Return the json string to the client //echo $json; ?> I am sure the PHP file is reached because the test3.txt file has been written but data returned is always empty ( also tried using json data , changing names , looking at other examples like in http://www.brainxcode.cl/develop/echo.php where data is returned as a simple string... ) Help, please!!! |
||||
|
Maybe something in your finishedRequest() function doesn't work. Try replacing the code with something like this: alert('worked, data was:' + data); |
||||
|
Hello Erik, thank you for your reply , I really appreciate!!! I have tried wit the alert and the returned data is empty ( also data.length is 0 ) . I am still sure the PHP is working because the dummy file is written. I also tried to monitor network activity using chrome developer tools to see the request but this doesn't work ( and this could make sense being the canvas itself involved ) Do you know if there is any constraint on returned data format or header or whatsoever? Anyone using ccbDoHTTPRequest has a little hint to share? Thank you very much!!! |
||||
|
That's strange, it should work. What operating system / browser and version are you using? If you open your developer console in the browser (for example in chrome, this opens when pressing CTRL+Shift+I, then click the 'Console' tab), do you see any error messages or similar? |
||||
|
Hello thank you very much, this helped me solve it !!!!! Actually on the console I found the error XMLHttpRequest for http://xxy.com/index2.php required Cross Origin Resource Sharing (CORS). And searching more on the forum I found about .htaccess file , I added it and now it's working!!!! Thank you once again to everyone who helped |
|