有一些 javascript 查看以下 XML 的“注释”部分,我正在尝试添加另一个规则:“is-public”需要具有值:“true”。我试过添加public[count] = $j(this).find('is-public').text("true")();
似乎不起作用。谁能帮我吗?提前致谢
JAVASCRIPT:
$j(document).ready(function() {
$j('#ticket_fields_NONE').attr("disabled", true);
//Check to see if there isn't already a value
if(!$j('input#ticket_fields_NONE').val()) {
//setting the DOM Object to attach the queue to
var para = $j("select#ticket_assignee_id");
var roleID = new Array();
var count = 0;
var commentAuthor = new Array();
var ticketCreated = new Array();
var public = new Array();
//beginning of queue
para.queue("testQueue", function( next ){$j.get('/tickets/{{ticket.id}}.xml',
function(ticketCreateAt) {
$j(ticketCreateAt).find('comment').each(function() {
ticketCreated[count] = $j(this).find('created-at').text();
public[count] = $j(this).find('is-public').text("true")();
commentAuthor[count] = $j(this).find('author-id').text();
var timeUNIX = new Date();
timeUNIX.setISO8601(ticketCreated[count]);
ticketCreated[count] = Date.parse(timeUNIX)/1000;
//displays in the sidewidget it can be removed.
count++;
});
XML:
<ticket>
<assigned-at type="datetime" nil="true"/>
<assignee-id type="integer" nil="true"/>
<base-score type="integer">720</base-score>
<created-at type="datetime">2012-07-17T10:38:03+10:00</created-at>
<current-collaborators nil="true"/>
<current-tags>
topic-general_site_tech-facebook_question training_tim via_contact_form
</current-tags>
<description>test</description>
<due-date type="datetime" nil="true"/>
<entry-id type="integer" nil="true"/>
<external-id nil="true"/>
<group-id type="integer" nil="true"/>
<initially-assigned-at type="datetime" nil="true"/>
<latest-recipients nil="true"/>
<nice-id type="integer">218</nice-id>
<organization-id type="integer" nil="true"/>
<original-recipient-address nil="true"/>
<priority-id type="integer">0</priority-id>
<recipient nil="true"/>
<requester-id type="integer">237738133</requester-id>
<resolution-time type="integer" nil="true"/>
<solved-at type="datetime" nil="true"/>
<status-id type="integer">0</status-id>
<status-updated-at type="datetime">2012-07-17T10:38:03+10:00</status-updated-at>
<subject/>
<submitter-id type="integer">214034168</submitter-id>
<ticket-type-id type="integer">0</ticket-type-id>
<updated-at type="datetime">2013-04-19T12:53:45+10:00</updated-at>
<updated-by-type-id type="integer">0</updated-by-type-id>
<via-id type="integer">5</via-id>
<score type="integer">720</score>
<problem-id nil="true"/>
<has-incidents type="boolean">false</has-incidents>
<comments type="array">
<comment>
<author-id type="integer">237738133</author-id>
<created-at type="datetime">2012-07-17T10:38:03+10:00</created-at>
<is-public type="boolean">true</is-public>
<type>Comment</type>
<value>test</value>
<via-id type="integer">5</via-id>
<attachments type="array"/>
</comment>