javascript - 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 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 "+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 piece of snippet working on. when run specific page got "error:error::"
not sure why ajax call failed , console empty too
remove contenttype:false
or set proper contenttype contenttype: "application/json"
Comments
Post a Comment