function sendMessages(){
        var phoneNum=document.register.chrMob.value;
        if(!phoneNum){
            alert('请输入正确的手机号码。');return;
        }
        $.ajax({
            global: true,
            url: 'sendMessage.php',
            type: 'POST',
            data: 'phoneNum='+phoneNum,
            dataType: 'html',
            timeout: 2000,
            error: function(){
               alert('发送信息出错');
            },
            success: function(html){
                if(html=='1'){
                    alert('信息发送成功');
                }else{
                    alert('信息发送错误');
                }
            }
        });
    }
这段代码中,在Firefox中正常(显示了'信息发送成功'),在IE中出错(老显示'发送信息出错',但是sendMessage.php文件能顺利执行)
请问一下问题出在哪里?

解决方案 »

  1.   

                success: function(html){
                    alert(html)//alert下看是什么东西
                    if(html=='1'){
                        alert('信息发送成功');
                    }else{
                        alert('信息发送错误');
                    }
                } 
      

  2.   

    sendMessage.php中html返回的是1或0,1成功,0错误
      

  3.   


     $.ajax({ 
                url: 'sendMessage.php', 
                type: 'POST', 
                data: 'phoneNum=1', 
                success: function(html){                 if(html=='1'){ 
                        alert('信息发送成功'); 
                    }else{ 
                        alert('信息发送错误'); 
                    } 
                } 
            }); 
    先简化下试试,写这么多做什么
      

  4.   

    这个不需要写的            error: function(){
                  alert('发送信息出错');
                },