jquery/ajax json数据函数不工作

jquery/ajax json数据函数不工作,json,jquery,Json,Jquery,我有以下函数,它假设与另一台服务器对话,检索json数据并显示它。问题是该函数甚至没有启动查询,我做错了什么?代码被上传到ApacheTomcat服务器中,我使用wireshark进行跟踪,http端口上没有代码 $(document).ready( function() { var home_add='http://wcf.net:3300/gateway'; $('#handshake').click(function(){ alert(" sending json data"); fun

我有以下函数,它假设与另一台服务器对话,检索json数据并显示它。问题是该函数甚至没有启动查询,我做错了什么?代码被上传到ApacheTomcat服务器中,我使用wireshark进行跟踪,http端口上没有代码

$(document).ready( function() {
var home_add='http://wcf.net:3300/gateway';
$('#handshake').click(function(){
alert(" sending json data");
 function handshake(){     /*testing the function */ 
                      var data_send = {
                          "supportedConnectionTypes": "long-polling",
                          "channel": "/meta/handshake",
                          "version": "1:0"
                          };
                      $.ajax({                 /* start ajax function to send data */ 
                          url:home_add,
                          type:'POST',
                          datatype:'json',
                          contanttype:'text/json',
                          async: false, 
                          error:function(){ alert("handshake didn't go through")}, /* call disconnect function */
                          data:JSON.stringify(data_send),
                          success:function(data){
                          $("p").append(data+"<br/>");
                           alert("successful handshake")
                           }                    
                          })   

                          }
})})
提前感谢您的反馈
熔岩

u不呼叫握手功能

$(document).ready(function () {
var home_add = 'http://wcf.net:3300/gateway';
$('#handshake').click(function () {
    alert(" sending json data");
    $.ajax({                 /* start ajax function to send data */
        url: home_add,
        type: 'POST',
        datatype: 'json',
        contanttype: 'text/json',
        async: false,
        error: function () { alert("handshake didn't go through") }, /* call disconnect function */
        data: {
            "supportedConnectionTypes": "long-polling",
            "channel": "/meta/handshake",
            "version": "1:0"
        },
        success: function (data) {
            $("p").append(data + "<br/>");
            alert("successful handshake")
        }
    });

});

})

如果您使用的是Internet Explorer,那么您必须在页眉部分的jsp页面中添加以下代码

<script src="https://github.com/douglascrockford/JSON-js/blob/master/json2.js" />

试试这个并检查一下,可能会有用。

您好,谢谢您的回复,我根据您的反馈进行了回复,但它仍然不起作用: