Drop down menu 如何向select 2的ajax请求添加正文?
我想使用Select2框模拟向URL发送正文类型为纯文本的帖子,例如select*from table,但我要在哪里定义要发布的正文Drop down menu 如何向select 2的ajax请求添加正文?,drop-down-menu,jquery-selectors,jquery-select2,Drop Down Menu,Jquery Selectors,Jquery Select2,我想使用Select2框模拟向URL发送正文类型为纯文本的帖子,例如select*from table,但我要在哪里定义要发布的正文 $("#sales_ids").select2({ placeholder: "Select your Partners", multiple: 'multiple', ajax: { url: 'http://www.google.com/, dataType: 'j
$("#sales_ids").select2({
placeholder: "Select your Partners",
multiple: 'multiple',
ajax: {
url: 'http://www.google.com/,
dataType: 'json',
type: 'post',
multiple: 'multiple',
allowclear: 'true',
processResults: function p(data){
var mapped = $.map(data, function(obj) {
obj.text = obj.text || obj.name;
obj.id = obj.id || obj.salesId;
return obj;
})
return {
results: mapped
}
如果我希望纯文本select*from表位于文章正文中,那么这个字符串是在哪里键入的?你说“数据在这里”,我是否要把数据放在表中:从表中选择*?@perry请查看我编辑的答案。希望这能回答你的问题。非常感谢!我仍然有空的结果,但我得到了我需要的。很高兴我的回答帮助了你。佩里说:“如果你觉得有必要,请投票。”
$.ajax({
url: 'URL',
type: 'POST',
dataType: 'json',
async: false,
// Data Goes Here
data: 'select * from table'
contentType: 'test/plain'
success: function (data, textStatus, xhr) {
// Success Code
},
error: function (xhr, textStatus, errorThrown) {
console.log('Error in Database');
}
});