0

我想设置属性“数据评级”的值。它将使用 Ajax。

<div id="fixed_<s:property value="messageId"/>" **data-rating=**"<%=averageScore%>"></div> from ajax function though jquery that is as below :

`

$.ajax({
type : "POST",
cache:false,
url : '<s:url action="ratingStatus"/>',
dataType: "text",
data : 'score=' +score+'&messageId='+<s:property value="messageId"/>+'&categoryId='+<s:property value="categoryId"/>+'&threadId='+<s:property value="threadId"/>,
success : function(data) {
alert("inside Success...");

//here i want to set div attribute(data-rating) value from action class response that i have made...



//location.reload();

}
});`

如果有人可以请帮助我....

4

3 回答 3

5
$("#fieldId").attr("data-rating","value want to set");
于 2013-03-22T11:21:35.580 回答
1
$('#objectID').attr('data-rating', 'your value')
于 2012-09-18T11:02:38.897 回答
1

在你的成功函数内部

success : function(data) {

 $('#yourdivid').attr('data-rating','value from the response');
}
于 2012-09-18T11:03:46.150 回答