missing leading zero id from db using ajax
inside mysql db which is table employe in coloumn id_employee, some data have a leading zero, etc :
id_employee : 0378192919
empy_name : Jack
i need to get id_employee for delete employe in my aplication, then i using ajax method like this :
- if(id) {
- alert(id);
- $("#deleteBtn").unbind('click').bind('click',function(){
- $.ajax({
- url: 'pegawai/delpeg.php',
- type:'post',
- data: {emp_id : id},
- datatype: 'json',
- success:function(response) {
return value is
378192919
, the first number
0
not showing in alert box. why ? then how to get entire value id_employe from db ?
as u can see the picture above , when i retrive data, id_employee is show entirely , i cant delete this employee because she had id_employee with leading zero. its mean there is no data
378192919
in db , it should be
0378192919
, below is code for button delete carry data id_employee from looping result.
- <a type="button" data-toggle="modal" data-target="#editEmployModal" onclick="editEmploy('.$row['nip'].')">
- <span class="glyphicon glyphicon-edit"></span> Edit</a>
and below is js code for catch id_employee from php
function delEmploy(id = null) {
- if(id) {
-
- alert(id);
- $("#deleteBtn").unbind('click').bind('click',function(){
- $.ajax({
- url: 'pegawai/delpeg.php',
- type:'post',
- data: {nip :id},
- datatype: 'json',
- success:function(response) {
- if(response.success == true) {
the delete employe cant run because ajax function return id_employee without leading zero ..