需要帮助我的代码javascript
function edit_kamar(Kode)
{
save_method = 'update';
$('#form')[0].reset(); // reset form on modals
$('.form-group').removeClass('has-error'); // clear error class
$('.help-block').empty(); // clear error string
//Ajax Load data from ajax
$.ajax({
url : "<?php echo site_url('kamar_view/ajax_edit')?>/"+Kode,
type: "GET",
dataType: "JSON",
success: function(data)
{
$('[name="Kode"]').val(data.Kode);
$('[name="Deskripsi"]').val(data.Deskripsi);
$('#modal_form').modal('show'); // show bootstrap modal when complete loaded
$('.modal-title').text('FORM EDIT KAMAR'); // Set title to Bootstrap modal title
$('#Gambar-preview').show(); // show Gambar preview modal
if(data.Gambar)
{
$('#label-Gambar').text('GANTI GAMBAR'); // label Gambar upload
$('#Gambar-preview div').html('<img src="'+base_url+'upload/'+data.Gambar+'" class="img-responsive">'); // show Gambar
// $('#Gambar-preview div').append('<input type="checkbox" name="remove_Gambar" value="'+data.Gambar+'"/> Remove Gambar when saving'); // remove Gambar
}
else
{
$('#label-Gambar').text('UPLOAD GAMBAR'); // label Gambar upload
$('#Gambar-preview div').text('(No Gambar)');
}
},
error: function (jqXHR, textStatus, errorThrown)
{
alert('Error get data from ajax');
}
});
}
这是我的观点代码
<section class="content">
<!-- List View box -->
<div class="box xlist-view">
<div class="box-body table-scroll">
<!-- <button class="btn btn-default" onclick="reload_table()"><i class="glyphicon glyphicon-refresh"></i> Refresh</button> -->
<br><br>
<table id="table_id" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th style="width:1px; font-size:12px; vertical-align: middle;" bgcolor="#00a65a"><center><FONT COLOR="#FFFFFF"> NO</FONT></th>
<th style="width:1px; font-size:12px; vertical-align: middle;" style="font-size:10px" bgcolor="#00a65a"><center><FONT COLOR="#FFFFFF"> KODE</FONT></th>
<th style="width:1px; font-size:12px; vertical-align: middle;" style="font-size:10px" bgcolor="#00a65a"><center><FONT COLOR="#FFFFFF"> RUANGAN</FONT></th>
<th style="width:1px; font-size:12px; vertical-align: middle;" style="font-size:10px" bgcolor="#00a65a"><center><FONT COLOR="#FFFFFF"> KELAS</FONT></th>
<th style="width:1px; font-size:12px; vertical-align: middle;" style="font-size:10px" bgcolor="#00a65a"><center><FONT COLOR="#FFFFFF"> KAMAR</FONT></th>
<th style="width:100px; font-size:12px; vertical-align: middle;" style="font-size:10px" bgcolor="#00a65a"><center><FONT COLOR="#FFFFFF">JUMLAH TT</FONT></th>
<th style="width:100px; font-size:12px; vertical-align: middle;" style="font-size:10px" bgcolor="#00a65a"><center><FONT COLOR="#FFFFFF">SISA TT</FONT></th>
<th style="width:1px; font-size:12px; vertical-align: middle;" style="font-size:10px" bgcolor="#00a65a"><center><FONT COLOR="#FFFFFF"> TARIF</FONT></th>
<th style="width:100px; font-size:12px; vertical-align: middle;" style="font-size:10px" bgcolor="#00a65a"><center><FONT COLOR="#FFFFFF">DESK</FONT></th>
<th style="width:100px; font-size:12px; vertical-align: middle;" style="font-size:10px" bgcolor="#00a65a"><center><FONT COLOR="#FFFFFF"> IMAGE</FONT></th>
<th style="width:100px; font-size:12px; vertical-align: middle;" style="font-size:10px" bgcolor="#00a65a"><center><FONT COLOR="#FFFFFF"> KONTROL</FONT></center> </th>
</tr>
</thead>
<tbody>
<?php
$no = 0;
foreach($displaykamar as $book)
{
$no++;
?>
<tr>
<td style="font-size:12px; vertical-align: middle;"><center><?php echo $no;?></td>
<td style="font-size:12px; vertical-align: middle;"><center><?php echo $book->Kode;?></td>
<td style="font-size:12px; vertical-align: middle; "><center><?php echo $book->Ruangan;?></td>
<td style="font-size:12px; vertical-align: middle;"><center><?php echo $book->Kelas;?></td>
<td style="font-size:12px; vertical-align: middle;"><center><?php echo $book->Kamar;?></td>
<td style="font-size:12px; vertical-align: middle;"><center><?php echo $book->JumlahTT;?></td>
<td style="font-size:12px; vertical-align: middle;"><center><?php echo $book->SisaTT;?></td>
<td style="font-size:12px; vertical-align: middle;"><center><?php echo number_format($book->Tarif,2,",",".")?></center></td>
<td style="font-size:12px; vertical-align: middle;"><?php echo $book->Deskripsi;?></td>
<?php
if($book->Gambar)
// echo '<td width="10%"><center><img src="base_url('upload/'.$book->Gambar)" class="img-responsive" width="85px" height="85px" /></a></center></td>';
echo '<td width="10%"><center><img src="'.base_url('upload/'.$book->Gambar).'" class="img-responsive" width="85px" height="85px"></center></td>';
else
echo '<td width="10%"><center><img src="'.base_url('upload/noimage_kamar.png').'" class="img-responsive" width="75px" height="75px"></center></td>';
// echo '<td width="10%"><center><img src="upload/noimage_kamar.png" class="img-responsive" width="75px" height="75px" /></center></td>';
?>
<td style="vertical-align: middle;"><center>
<button class="btn btn-warning" onclick="edit_kamar(<?php echo $book->Kode;?>)"><i class="glyphicon glyphicon-pencil"></i></button>
<!-- <button class="btn btn-warning" href="javascript:void(0)" title="Edit" onclick="edit_kamar(<?php echo $book->Kode;?>)"><i class="glyphicon glyphicon-pencil"></i></button>
<button class="btn btn-danger" onclick="delete_book(<?php echo $book->Kode;?>)"><i class="glyphicon glyphicon-remove"></i></button> -->
</td>
</tr>
<?php }?>
</tbody>
<tfoot>
</tfoot>
</table>
<!-- <button class="btn btn-default" onclick="reload_table()"><i class="glyphicon glyphicon-refresh"></i> Refresh</button> -->
</div>
</div>
这是错误:
localhost:8080/Simrsgum1/kamar_view/ajax_edit/2.16100001161e+24
您提交的URI不允许使用字符。
因为我认为链接应该得到所有数字不被削减 应该这样:
localhost:8080/Simrsgum1/kamar_view/ajax_edit/2161000011610000116100001
答案 0 :(得分:1)
尝试此代码。
请打开您的config.php文件,然后找到此
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-';
然后你需要将值设置为空白
$config['permitted_uri_chars'] = '';
然后再试一次,你的脚本运行正常。