我有一个动态显示的xeditable字段。我想用select2来更新它。
$(document).ajaxComplete(function () {
$('.marketing_event_id').editable({
emptytext: ".....",
url: "ajax_xeditable_update.php?table=appointments",
source: promo_codes,
select2: {
width: 200,
placeholder: 'Select promotion code...',
allowClear: true,
}
});
});
//get the promo codes for the select2 box for xeditable. put it outside of ajaxcomplete so it doesn't keep firing off for every appt!
var promo_codes = [];
$.getJSON('ajax_get_json.php?what=location_promo_codes', function (data) {
$.each(data, function (index) {
promo_codes.push({
id: data[index].value,
text: data[index].text
});
});
});
select2框会向用户显示所有JSON选项,但是当选择了一个选项并且“勾选标记”时,选择按钮来更新字段,没有任何反应。我正在观看Chrome中的网络屏幕,并且Xeditable字段的网址甚至无法触发。
这是我的html字段的样子:
echo '<h5>Promotion Code: <a href="#" class="marketing_event_id appointment' . $result->id . '" data-name="marketing_event_id" data-type="select2" data-value="'; if(!empty($result->marketing_event_id)) { echo $result->marketing_event_id; } echo '" data-placement="right" data-original-title="Enter the appointment promo code." data-pk="'. $result->id . '">' . $result->promo_code .'</a></h5>
数据字段填写正常。我没有看到任何错误。
以下是用于填充select2的getJSON信息示例:
[{"value":"663","text":"christmas2015"},{"value":"651","text":"web08"},{"value":"658","text":"paper0815"}]
如果需要,我很乐意提供更多代码。
有人可以解释为什么在更新字段时URL不会触发吗?谢谢。
答案 0 :(得分:0)
我想到了这一点,但我不太明白为什么会这样。
我在xeditable区域添加了一行代码:
qw >= qwT