Hi, I need some help for this onclick function, my problem is that i could not get the exact value returned by the ajax.
for example the value should be like this
000005
when i tried to alert, it will only gives me 5 not 000005
$(function(){
$.ajax({
type: 'post',
url: 'to_other_page.php',
data: {id:id},
success: function(data){
some code here...
}
});
});
function LoadMyData(idx){
alert(idx);
$.ajax({
type: 'post',
url: 'Studentpage.php',
data: {id:idx},
success: function(data){
some code here...
}
});
}
here is the separate file,
this is where i am going to use the onclick function
to_other_page.php
let’s just assumed that i have successfully queried the student table.
$query = mysql_query('select * from student');
while ($row = mysql_fetch_array( $query)) {
<tr onclick="LoadMyData('.$row['std_id'].')">
<td >$row['std_id']</td>
<td >$row['std_name']</td>
</tr>
}
when i opened the console in firebug i can see that the inside of my function is 000005
but when it returned to other page it will only alert 5.
can you please help me what is wrong with this.
Thank you in advance.