Tuesday 15 January 2013

Javascript and PHP - blocking page until job is finished -



Javascript and PHP - blocking page until job is finished -

i need execute programme xprog pfile.php, executed jfile.js.

this xprog, after finishing determined task, writes info text file.

what want accomplish is:

retrieving content of file. execute programme xprog, update content of text file. loop blocking page activity until old content of text file different new content.

this wrote:

jfile.js:

$.blockui({ message: $("#msg"), css: { cursor: 'inherit'}}); $("#activity").html($old); $("#content").load("pfile.php", { var1: $("#var1_id").val(), var2: $("#var2_id").val(), var3: $("#var3_id").val(), var4: $("#var4_id").val(), var5: $("#var5_id").val(), var5: $("#var5_id").val() });

pfile.php:

<?php $datafile = '/path/to/datafile'; $datafilecontent = file_get_contents($datafile); $datafilecontentnext = $datafilecontent; function compcontent($datafile, $datafilecontent, $datafilecontentnext) { while($datafilecontent == $datafilecontentnext) { $datafilecontentnext = file_get_contents($datafile); } ?><script type="text/javascript">$unblockui();</script><?php } $var1 = urlencode($_post["var1"]); /* assign values var2, var3 etc. */ $xprog = '/path/to/xprog'; /* execute xprog */ exec($xprog); /* loop until content of file changed */ compcontent($datafile, $datafilecontent, $datafilecontentnext); include("filetowebpage.php"); ?>

but unblockui function not executed (even if content of text file changed), instead execution of function php file casue error:

cannot send session cache limiter.

so web page activity blocked on execution of blockui.

even if phone call unblockui javascript file, code not work. understand approach solve problem not correct.

how can edit code create works ?

thank in advance.

javascript php blockui

No comments:

Post a Comment