为什么这个ajax调用不会返回?

时间:2016-08-11 15:32:26

标签: javascript php ajax

调用此例程后,我逐步调试调试器,在完成,失败和完成处理程序中放置断点,但不会捕获任何断点。

var data = {};
data.file = file_data;
data.action = 'upload';
data.title = $('#title').val();
data['form-type'] = $("#form-type").val();
data.genre = $("#genre").val();
data['nbr-pages'] = $("#nbr-pages").val();
data['account-id'] = localStorage.getItem("account-id");

$.ajax({
    type: 'post',
    url:  url,
    data: data,
    dataType: 'text'
}).done(function (result, success, xhr) {
   if (result.indexOf("PDF") == -1) {
       showMessage(1, "Your submission will go live and you will be notified after our reviews are complete.");
       JSON.parse(result);
       sessionStorage.setItem('writer-id', result.id);
       sessionStorage.setItem('filename', result.filename);
   } else {
       showMessage(0, result);
   }

}).fail(function (xhr, desc, err) {
    var msg = formatError(errmsg, err, xhr.responseText);
    showMessage(0, msg);
    console.log(msg);
}).always(function(result) {
    console.log ("complete="+result );
});

相关PHP

echo json_encode(array("id"=>"$id", "filename"=>"$NewFileName"));

0 个答案:

没有答案
相关问题