所以我有一个页面,其中包含一个从进程页面填充的隐藏输入字段。我想创建一个php变量,其值为输入框的值。我怎么能这样做?
添加了代码。所以基本上我需要一个变量($ curActiveJobNames),它具有curJobName输入字段中的任何值。
首页
<p><input id="curJobName" value=""></input></p>
<p >
<? if ($curActiveJobName) {
$gearSrc = 'fa fa-gear fa-spin';
$activeOperations = 1;
} else {
$gearSrc = 'fa fa-gear';
}
?>
<i class="<?=$gearSrc; ?>"></i>
<?if ($curActiveJobName) {
if($curActiveJobName == 'deployVApp') {
print $curActiveJobName . " - " . $vApp->get('status');
} else {
print $curActiveJobName;
}
} elseif ($vApp->get('status') == 'PR') {
print $languageDB->berkGet("content_provisioning");
} elseif ($vApp->get('status') == 'FA') {
print $languageDB->berkGet("content_failed_to_create");
} elseif ($vApp->get('status') == 'IN') {
print $languageDB->berkGet("content_stopped");
} else {
print $languageDB->berkGet("content_none");
}
?>
</p>
包含文件
$(document).ready(function() {
var activeJob = false;
setInterval(function() {
$.ajax({
url: '/processJobStatus.php',
type: 'GET',
data: { action: 'jobStatus' },
async: true,
success: function(returnParameters) {
count = returnParameters.count;
status = returnParameters.status;
if(count > 0) {
activeJob = true;
name = returnParameters.name;
status = returnParameters.status;
$('#clientJobList').css('display', 'block');
$('#jobName').html(name);
document.getElementById("curJobName").value = name;
$('#jobStatus').html(status);
} else {
if (activeJob === true) {
activeJob = false;
location.reload(true);
}
$('#clientJobList').css('display', 'none');
}
},
error: function(jqXHR, textStatus, errorThrown) {
}
});
}, 1000);
});
</script>