简体   繁体   English

Ajax呼叫总是失败

[英]Ajax call always getting failed

<script type="text/javascript">
function dialogsf() {
     $("#loadingsf").dialog({
         hide: 'slide',
         show: 'slide',
         autoOpen: true
     });
     $("#loadingsf").dialog('open').html("<p>Please Wait while contacts are imported...</p>");
     //alert("dfsd");
 }
 var fd = 1;
 $(document).ready(function () {
     dialogsf();
     $.ajax({
         url: "get_contacts.php",
         type: "GET",
         data: {
             sid: 'a'
         },
         processData: false,
         contentType: false,
         success: function (response) {
             // alert("Import done successfully with "+contacts.length+ " contacts");
             alert("Import done successfully");
             $('#loadingsf').html("<p>Result Complete...</p>");
         }
     }).fail(function (xhr, status, error) {
         alert('error:' + status + ':' + error + ':' + xhr.responseText)

     }).done(function (respond) {
         location.href = respond;

     });

 });
</script>
    <body >
    <div id="loadingsf" title="SF Contact Import"> 
    <p>Please wait ...</p>
</div>

This is the piece of snippet I am working on. 这是我正在研究的片段。 When I run the specific page I got this "error:error::" Not sure why the ajax call is always failed and the console is empty too 当我运行特定页面时,我得到了这个"error:error::"不确定为什么ajax调用总是失败并且控制台也为空

删除contentType:false或将适当的contentType设置为contentType: "application/json"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM