jquery editable ajax,jquery - How to override x-editable ajax response value? - Stack Overflow

博主在尝试使用x-editable进行inline编辑时遇到问题,当通过AJAX更新值并获取响应后,无法正确覆盖包含新x-editable值的div。尽管尝试用`$('#freight').html('$'+newValue);`来更新元素,但页面显示的仍然是没有美元符号的数值。寻求解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I am using x-editable to do inline editing. When I update the value via ajax and x-editable to get the response, I am finding it very difficult to override the div that contains the new x-editable value.

For example, my x-editable link looks like this:

$100

I enter my edit in the pop-up that x-editable provides then enter the value 300.00

When I do my edits, I proceed as follows:

$('#freight').editable({

validate: function(value) {

if($.trim(value) == '') return 'This value is required.';

},

type: 'text',

url: '{{ path('update_purchase_order_ajax') }}',

pk: {{ purchaseOrder.id }},

title: 'Enter Freight Value',

ajaxOptions: {

dataType: 'json'

},

success: function(response, newValue) {

// Update the purchase order amounts...

$('#freight').html('$' + newValue);

}

});

When x-editable is finished, the value that shows up on the page is now 300.00 (without the $ dollar sign). As you can see in my jquery code, I am trying to override the value x-editable is putting on the page with $('#freight').html('$' + newValue);

For some reason this is not working. I want $300.00 to show up, not 300.00.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值