如何在表单输入字段中显示此 $data 值?

how can i show this $data value in the form input field?

如何在表单输入字段中显示 $data 值?

<head>
    <script>
        $(function () {
            $("#task_id").change(function () {
                var task_id = $(this).val();
                var url = "status/tasks/get_task_info/" + task_id;
                $.ajax({
                    url: url,
                    beforeSend: function () {
                        $(".load-taskinfo").html('<img src="images/ajax/ajax-loader10.gif">');
                    },
                    success: function (response) {
                        $data = JSON.parse(response);
                    }
                });
            });
        });
    </script>
</head>
<body>
<div class="span3">
    <div class="control-group <?php echo (form_error('progress_percent')) ? 'error' : ''; ?>">
        <label class="control-label" for="progress_percent">Progress (In %) :</label>
        <div class="controls">
            <?php echo form_input(array(
                'name' => 'progress_percent',
                'id' => 'progress_percent',
                'maxlength' => 160
            )); ?>
            <?php if (form_error('progress_percent')) : ?>
                <span class="help-inline">
                <?php echo form_error('progress_percent'); ?>
              </span>
            <?php endif; ?>
        </div>
    </div>
</div>
</body>

在您的成功回调中,使用 jQuery selector to select the input by ID or by name,并填写其值。

success: function (response) {
    var $data = JSON.parse(response);
    $('#progress_percent').val($data);
}