Sunday 15 July 2012

ajax - How to access/include evaluated PHP script in HTML? -



ajax - How to access/include evaluated PHP script in HTML? -

i'm using nusoap create webservice sends commands remote command (client) server these commands evaluated. now, need access info calculated function of webservice client. currently, i'm trying via ajax. think need decouple webservice script handles ajax how access info webservice? tried session variables not working. here code example:

ajax

if(isset($_post['source'])){ if(isset($_session['commandresult'])){ unset($_session['commandresult']); } while(!isset($_session['commandresult'])){ session_write_close(); usleep(2000000); //wait 2 seconds session_start(); if(isset($_session['commandresult'] && $_session['commandresult']!= "ready")){ echo $_session['commandresult']; break; } } }

ws function

function executecommand($command) { session_start(); $_session['commandresult'] = "ready"; if($command=="resume"){ $_session['commandresult'] = "resume"; } else if($command=="pause"){ $_session['commandresult'] = "pause"; } else { $_session['commandresult'] = $command; } homecoming $_session['commandresult']; session_write_close(); }

i tried putting webservice straight index.php nusoap doesn't (extra content @ end of file errors). there totally different best practice here?

php ajax web-services

No comments:

Post a Comment