没有得到服务器ajax的回复

时间:2014-10-18 14:41:16

标签: ajax response

当我使用ajax将数据发布到服务器时,我没有从服务器获得响应。我的代码在下面给出..

<body>

$(文件)。就绪(函数() {     var contentType =&#34; application / x-www-form-urlencoded;字符集= UTF-8&#34 ;;

if(window.XDomainRequest)
    contentType = "application/json; charset=utf-8;";

$("#postdata").click(function()
{
    $.ajax({
     crossDomain: true,
     url:"http://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
     type:"POST",
    data:"api_key=985nn5765n54333ggf666&api_secret=:hjk435jkk345j34hjjjkcjkkjn46665ny&username=colin123&email=jotcoli23h@gmail.com&password=123",

     dataType:"jsonp",   
     contentType:contentType,    
     success:function(data)
     {
        alert("Data from Server"+JSONP.stringfy(data));
     },
     error:function(jqXHR,textStatus,errorThrown)
     {
        alert("You can not send Cross Domain AJAX requests: "+errorThrown);
     }
    });

0 个答案:

没有答案