衫裤跑路 2013-04-05 05:28 采纳率: 50%
浏览 22

Ajax在哪里调试

I have this very basic webpage that makes an AJAX call to a aspx file.

It all works great on my development machine. But when I test it on the production machine I get nohting nor any kind of error.

I have different IP addresses's and port number's between the two machines. But I have checked that these differences are handled.

The page displays ok and reponds to the click event ok.

The production machine worked once when setup as localhost for the call but once I changed that, it stopped. I have rechecked ip and port and they are correct.

I have copied the file a couple of times in case of corruption.

The only thing I can think is the port number is 20201, is this something I shouldn't use.

The dev machine is win7 target is xp, both running xampp.

It is supposed to be a custom page for home automation, the Ajax call is to speak to some software called homeseer.

Where or what can I change to see whats wrong.

I am puzzled as all works great in test and I get nothing positive or negative in the production world.

many thanks for any help.

<!DOCTYPE html>
<html>
<head>
<Script type="text/javascript" src="jquery/jquery-1.7.1.js"></script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    alert($(this).parent().attr("class"));

 var $x10Device = $(this).parent().attr("class");
 $.ajax({
    type: 'GET',
    url: "http://192.168.0.34:81/tenHsServer/tenHsServer.aspx",
    data: { 
        t: "ab", 
        f: "ToggleDevice" ,
        d:$x10Device
    }
});

 });
});
</script>
</head>
<body>
<div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div>
<SPAN class='C8'><button>8Get External Content</button></SPAN>
<SPAN class='C1'><button>1Get External Content</button></SPAN>
<SPAN class='C2'><button>2Get External Content</button></SPAN>
<SPAN class='C3'><button>3Get External Content</button></SPAN>
<SPAN class='C4'><button>4Get External Content</button></SPAN>
<SPAN class='C5'><button>5Get External Content</button></SPAN>
</body>
</html>
  • 写回答

1条回答 默认 最新

  • 胖鸭 2013-04-05 05:32
    关注

    Add an error callback into your ajax() arguments. eg:

    $.ajax({
        type: 'GET',
        url: "http://192.168.0.34:81/tenHsServer/tenHsServer.aspx",
        data: { 
            t: "ab", 
            f: "ToggleDevice" ,
            d:$x10Device
        },
        error: function (jqXHR, textStatus, errorThrown) { console.debug (textStatus, errorThrown); }
    });
    
    评论

报告相同问题?

悬赏问题

  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示