2011-12-25 12 views
0

SharePoint 2003でリストを更新できるアプリケーションを作成しようとしています。完全に機能するアプリケーションが1つありますが、これは機能しません。UpdateListItems(成功)ですが、効果はありませんか?どうして?

SharePointの呼び出しが更新されていない理由を教えてください。私は終了時に "成功" -msgを得る。私はそこにテキストラインである蟻を記入する必要があります。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<title></title> 
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.js" type="text/javascript"></script> 
</head> 
<body> 
    <h1></h1><span id="numbersOfRows"></span> 
<div> 
<script type="text/javascript"> 
    $(document).ready(function() { 
    $("#newTaskButton").click(function() { 
     CreateNewItem($("#newTaskTitle").val()); 
    }); 
}); 

function CreateNewItem(Customer) { 
    var batch = 
     "<Batch OnError=\"Continue\"> \ 
      <Method ID=\"1\" Cmd=\"New\"> \ 
        <Field Name=\"Event name\">test</Field> \ 
      </Method> \ 
     </Batch>"; 

    var soapEnv = 
     "<?xml version=\"1.0\" encoding=\"utf-8\"?> \ 
     <soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \ 
      xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \ 
      xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"> \ 
      <soap:Body> \ 
      <UpdateListItems xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\"> \ 
       <listName>On the road</listName> \ 
       <updates> \ 
       " + batch + "</updates> \ 
      </UpdateListItems> \ 
      </soap:Body> \ 
     </soap:Envelope>"; 

    $.ajax({ 
     url: "homepage/_vti_bin/lists.asmx", 
     beforeSend: function(xhr) { 
      xhr.setRequestHeader("SOAPAction", 
      "http://schemas.microsoft.com/sharepoint/soap/UpdateListItems"); 
     }, 
     type: "POST", 
     dataType: "xml", 
     data: soapEnv, 
     complete: processResult, 
     contentType: "text/xml; charset=utf-8" 
    }); 
} 
function processResult(xData, status) { 
    document.getElementById("alertMsg").innerHTML = status; 
} 

</script> 

    <p> 
     Task Title: 
     <input id="newTaskTitle" type="text" /> 
     <input id="newTaskButton" type="button" value="Create Task" /> 
    </p> 
    <h1>Alert:</h1><span id="alertMsg"></span> 


</div> 

</body> 

答えて

0

あなたの関数の先頭にこのどこかに置いてください。 jQuery ajaxメソッドのエラー処理ステータスを設定します。しかし、これを使用するには、新しいバージョンのjQueryに移動する必要があると思います($ .ajax()の下にあるjQueryドキュメントを参照)。

$("#divId").ajaxError(function(event, request, settings, exception) { 
    $(this).append("Error here: " + settings.url + ", exception: " + exception); 
}); 

ここで、id = "divId"のDIVはどこかにあります。

このテクニックは私の命を救ってくれました。

関連する問題