我有一个搜索表单,当有人在其中输入内容时,它会做出反应。我希望它在粘贴内容时也能做出反应,可以吗?现在,粘贴的文本后面必须有一个空格。
我有一个搜索表单,当有人在其中输入内容时,它会做出反应。我希望它在粘贴内容时也能做出反应,可以吗?现在,粘贴的文本后面必须有一个空格。
<input type="text" name="search_text" id="search_text" placeholder="" class="fontAwesome" />
<div id="result"></div>
<script>
$(document).ready(function () {
load_data();
function load_data(query) {
$.ajax({
url: "oSearch.php",
method: "POST",
data: { query: query },
success: function (data) {
$("#result").html(data);
},
});
}
$("#search_text").keyup(function () {
var search = $(this).val();
if (search != "") {
load_data(search);
} else {
load_data();
}
});
});
</script>
/ASP.NET 使用 jQuery AJAX 调用 SharePoint Rest Api 获取 \'401 (未授权)\'/请在授权部分'授权'中提供帮助:\'NTLM \' +btoa(用户名:密码) 添加项目...
/ ASP.NET 使用 jQuery AJAX 调用 SharePoint Rest Api 时获取 \'401 (未授权)\' /
请帮助授权部分
'Authorization': "NTLM " +btoa(username:password)
Add Item to SharePoint List
<h1>Add Item to SharePoint List</h1>
Username:
<br>
Password:
<br>
Add Item
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
$('#addItemForm').submit(function(event) {
event.preventDefault();
const siteUrl = 'https://your-sharepoint-site-url.com'; // Update with your SharePoint site URL
const listTitle = 'YourListTitle'; // Update with your SharePoint list title
const endpointUrl = `${siteUrl}/_api/web/lists/getbytitle('${listTitle}')/items`;
const newItemData = {
'Title': 'New Item Title',
'Description': 'This is a new item added from an external application.'
// Add more properties as needed for your SharePoint list columns
};
const username = $('#username').val();
const password = $('#password').val();
const basicAuth = 'NTLM ' + btoa(username + ':' + password);
$.ajax({
url: endpointUrl,
type: 'POST',
headers: {
'Accept': 'application/json;odata=verbose',
'Content-Type': 'application/json;odata=verbose',
'Authorization': "NTLM " +btoa(username:password)
},
data: JSON.stringify(newItemData),
success: function(data) {
console.log('New item created successfully:', data);
// Optionally, display a success message to the user
},
error: function(error) {
console.error('Error creating new item:', error);
// Optionally, display an error message to the user
}
});
});
});
</script>