我有一个带表单的动态模态窗口。当我更新表单字段并单击更新按钮时,我无法获取js中更改的值,但它给了我原始值。
如何获取更改的值而不是原始形式的值。
PHP中的我形成了模态窗口的内容并将其返回到ajax以填充模态中的内容:
$provide.decorator('$exceptionHandler', ['$injector',
function ($injector) {
return (exception, cause) => {
$injector.invoke((ServerLogger, ServerErrorLogMessageFormatter) => {
ServerLogger.error(
ServerErrorLogMessageFormatter.formatServerErrorLogMessage(
exception, cause));
});
};
}]);
使用内容
填充模态的JS代码$content="
<div class='modal-header'>
<button type='button' class='close' data-dismiss='modal' aria-hidden='true'>×</button>
<h4 class='modal-title' id='formModalLabel'>Edit Banner</h4>
</div>
<form class='form-horizontal' role='form'>
<div class='modal-body'>
<div class='form-group'>
<div class='col-sm-3'>
<label for='title' class='control-label'>Title</label>
</div>
<div class='col-sm-9'>
<input type='text' name='title' id='title' class='form-control' placeholder='title' value='$title'>
</div>
</div>
<div class='form-group'>
<div class='col-sm-3'>
<label for='alt' class='control-label'>Alternate</label>
</div>
<div class='col-sm-9'>
<input type='text' name='alt' id='alt' class='form-control' placeholder='alt' value='$alt'>
</div>
</div>
<div class='form-group'>
<div class='col-sm-3'>
<label for='url' class='control-label'>Image URL</label>
</div>
<div class='col-sm-9'>
<input type='text' name='url' id='url' class='form-control' placeholder='url' value='$url'>
</div>
</div>
<div class='form-group'>
<div class='col-sm-3'>
<label for='link' class='control-label'>Link</label>
</div>
<div class='col-sm-9'>
<input type='text' name='link' id='link' class='form-control' placeholder='link' value='$link'>
</div>
</div>
</div>
<div class='modal-footer'>
<button type='button' class='btn btn-default' data-dismiss='modal'>Cancel</button>
<button type='button' id='$pid' class='btn btn-primary updatebtn'>Update</button>
</div>
</form>
";
echo $content;
单击模态窗口中的更新按钮的JS代码
success: function(html)
{
$('.modal-content').show().html(html);
$("#formModal").modal("show");
}
由于
AJ