Files
2024-10-29 14:04:59 +08:00

56 lines
2.4 KiB
HTML
Executable File

<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">编辑</h4>
</div>
<div class="modal-body">
<form id="modal-file-form">
<div class="form-group">
<label for="recipient-name" class="control-label">文件名:</label>
<p class="form-control-static"><?php echo $filename;?></p>
<input type="hidden" class="form-control" name="filename" value="<?php echo $filename;?>">
</div>
<div class="form-group">
<label for="file-text" class="control-label">文件内容:</label>
<textarea class="form-control" id="file-text" rows="10" name="filecontent"><?php echo isset($content)?$content:'';?></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary" data-formbtn="submit">提交</button>
</div>
</div><!-- /.modal-content -->
</div><!--/.modal-dialog -->
<script type="text/javascript">
$(function() {
$('#modal-file-form').bind('submit', function() {
var options = {
url: "<?php echo url('/admin/tool/updatecontent');?>",
type: "post",
cache: false,
dataType: "json",
data: $('#modal-file-form').serialize(),
success: function(data) {
if (data.code) {
alert(data.msg);
}
},
complete: function() {
//HideLoading();
$('#modal-file-content').modal('hide');
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
};
$.ajax(options);
return false;
});
$("[data-formbtn='submit']").click(function() {
$('#modal-file-form').submit();
});
});
</script>