Jquery unidentified data return when post

Posted by Nhat Tuan on Stack Overflow See other posts from Stack Overflow or by Nhat Tuan
Published on 2013-11-07T09:57:05Z Indexed on 2013/11/07 21:55 UTC
Read the original article Hit count: 258

Filed under:
|
|
<?php //load.php
$myid = $_POST['id'];
if($myid == 1){
    echo '1';
}else if($myid == 0){
    echo '0';
}
?>
<html>
    <input id="id" />
    <div id="result"></div>
    <input type="button" id="submit" />
    <script type="text/javascript">
      $('#submit').click( function(){
        var send = 'id=' + $('#id').val();
        $.post('load.php', send, function(data){
            if(data == 1){
                $('#result').html('Success');
            }else if(data == 0){
                $('#result').html('Failure');
            }else{
                $('#result').html('Unknow');
            }
        });
      });
    </script>
</html>

I test this script in some free host and it work but in my real host jquery unidentified data return and it alway show 'Unknow'.

When i change if(data == '1') it show 'Unknow' too

EX: input id = 1 click submit & data return is 'Unknow'

Why ?? I think this error from host, because i test it in some free host and it work, but now in my real host i got this error, how i can fix it ?

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery