Spservice add list item

<table>
<tbody>
<tr>
<td>
<strong>List Item to be added</strong>
</td>
<td>
<input name=”txtTitle” id=”txtTitle” type=”text” />
</td>
</tr>
<tr>
<td>
<input name=”ADD” id=”btnADD” type=”button” value=”Add Item to List” />
</td>
</tr>
</tbody>
</table>

https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js
https://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.02/jquery.SPServices-2014.02.min.js

$(document).ready(function() {
$(“#btnADD”).click(function() {
var title = $(“#txtTitle”).val();
AddListItem(title);
});

});

function AddListItem(TitleField) {
$().SPServices({
operation: “UpdateListItems”,
async: false,
batchCmd: “New”,
listName: “TestForms”,
valuepairs: [
[“Title”, TitleField]
],
completefunc: function(xData, Status) {
alert(“Data Saved! and Please check your List”);
window.location.href = window.location.href;
}
});
}

Geplaatst in Spservices
Meest recente berichten
Recente reacties
Archief
Categorieën