有一个关于x可编辑select的快速问题。
我希望在select中获取所选项目的文本,并将其传递给.Net处理程序,以便以后可以将其添加到审核表中。
有人知道我是怎么做到的吗?
这就是我目前的情况:
锚定守则:
<a class='editable' data-type='select' data-name='statusid' data-pk='1027' data-params='{"original": "In Progress"}' data-value='2' data-source='handlers/getHDMLists.ashx?l=1' id='status'>In Progress</a>jQuery邮报:
$('#status').editable({
showbuttons: true,
url: function (params) {
return $.ajax({
type: 'POST',
url: 'handlers/putHDMTicketDetails.ashx?ac=1',
data: params,
params: '{"new": "' + $(this).text() + '"}' ,
async: true,
cache: false,
timeout: 10000,
success: function (response) {
if (response != null) {
if (response.msg == "SUCCESS") {
$.gritter.add({
title: 'Update Successful',
text: 'Support ticket details update was successful.',
class_name: 'gritter-success gritter-center gritter-light'
});
} else {
$.gritter.add({
title: 'Something went wrong!',
text: 'There seems to have been an error with your requested update, please try again and if you continue to receive this message please contect your site administrator.',
class_name: 'gritter-error gritter-center'
});
}
} else {
$.gritter.add({
title: 'Something went wrong!',
text: 'There seems to have been an error with your requested update, please try again and if you continue to receive this message please contect your site administrator.',
class_name: 'gritter-error gritter-center'
});
}
},
error: function () {
$.gritter.add({
title: 'Something went wrong!',
text: 'There seems to have been an error with your requested update, please try again and if you continue to receive this message please contect your site administrator.',
class_name: 'gritter-error gritter-center'
});
}
});
}
});如您所见,我可以使用anochor中的数据-params占位符获取原始文本,但是我尝试使用$(this).text()获取新选定的文本,但是忽略了:-(
任何帮助都会很好。
奥兹
发布于 2014-11-17 09:52:17
好的,经过一点跟踪之后,X可编辑提供的输入元素没有ID或名称,但是,它们被包装在一个带有可编辑输入类的div中。
将上述代码行更改为:
url: 'handlers/putHDMTicketDetails.ashx?ac=1',至
url: 'handlers/putHDMTicketDetails.ashx?ac=1&new=' + $('.editable-input').find(':selected').text(),很好地对问题进行排序,并在所有输入元素之间一致地工作。
奥兹
https://stackoverflow.com/questions/26955801
复制相似问题