0
好日子每一个,我与阿贾克斯工作,以检查值是否相同或不,我得到真正的数据成功的Ajax,但是当我使用如果声明为JS警报其给我相反的结果,请assist-这里是我的代码 -如果语句给予ajax成功相反的结果
的index.php
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">
</script>
<script type="text/javascript">
$(function() {
setInterval("alert()", 5000);
});
function alert() {
var aval=1;
$.ajax({
type: "POST",
url: "php.php",
data: 'uid=' + aval,
success: function(html)
{ // this happen after we get result
if (html.success == true)
{
alert ('Same Value');
}
else {
alert('Different Value')
}
}
});
}
</script>
Old Value:1<br>
<div>New Value:</div><div id="new" ></div>
php.php
<?php
//some php coding which shows result
echo '1';
?>
我同意,你也应该接受的答案 – 2015-09-09 10:02:47