Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
XML
var URL = 'http://lenovo-01442342:8000/personal/ruoshui/Docs/_vti_bin/lists.asmx';
var myTitle=$('#myTitle').val();

var myCity=$('#myCity').val();
var myMul=$('#myMulText').val();
var myCurrency = $('#myCurrency').val();
var myNum = $('#Num_Column').val();
var myDate= $('#My_Date').val();
var myCheckBox =$('#My_CheckBox').val();
var myChoice =$('#MyChoice').val();
var myPerson =$('#My_Person').val();
var myLookup=$('#My_Lookup').val();
var myPic = $('#Hy_Picture').val();
var batch='';
batch +='<updates><Batch>';
batch +='<Method ID="1" Cmd="New">';
batch +='<Field Name="Title">'+myTitle+'</Field>';
batch +='<Field Name="City">'+myTitle+'</Field>';
batch +='<Field Name="ruoshui_Multiple_lines">'+myMul+'</Field>';
batch +='<Field Name="Num_Column">'+myNum+'</Field>';
batch +='<Field Name="My_Currency">'+myCurrency+'</Field>';
batch +='<Field Name="My_Date">'+myDate+'</Field>';
batch +='<Field Name="My_CheckBox">'+myCheckBox+'</Field>';
batch +='<Field Name="MyChoice">'+myChoice+'</Field>';
batch +='<Field Name="Hy_Picture">'+myPic+'</Field>';
batch +='<Field Name="My_Person">'+myPerson+'</Field>';
batch +='<Field Name="My_Lookup">'+myLookup+'</Field>';
batch +='<Field Name="My_BD">....</Field>';
batch +='</Method>';
batch +='</Batch></updates>';
alert(batch);
//在这处我们拼接
var datas;
datas = '<?xml version="1.0" encoding="utf-8"?>';
datas = datas + '<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/">';
datas = datas+ '<soap:Body>';
datas = datas + '<UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">';
datas = datas + '<listName>{3541138C-0235-44FE-86F0-A6553F25CAEF}</listName>';
datas = datas +batch;


datas = datas + '</UpdateListItems>';
datas = datas + '</soap:Body>';
datas = datas + '</soap:Envelope>';

alert(datas);

$.ajax({
    url:URL,
    type:'POST',
    beforeSend:function(xhr){xhr.setRequestHeader("SOAPAction","http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");
    },
    dataType:'text/xml',
    data:datas,
    success:function(data1,status){alert(data1);},
    contentType:'text/xml; charset=utf-8'
});


My database define:
ID:int
name:char(12)
The name field will show in moss2007. But I do not know how to write
'<field name="My_BD">????'.
THS for any suggestion.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900