Using AJS to format the description

Hello, I want to display the Description of an Issue in my Plugin, but I get it in this form:

h2. Welcome to your first issue {color:#707070}An issue is an item you want to track in a specific JIRA project. You can use JIRA to track all kinds of things.{color} h4. Types of issues {color:#707070}An issue could represent a software bug, a user story, a project task, a helpdesk ticket, or a leave request form, the list is endless!{color} !IssueTypes.png! h4. Issue attributes {color:#707070}You may have noticed that an issue has some system fields such as: type, priority and status. These fields are there to help you categorise and track the progress of each issue.{color} Next: [Changing an issue's status|DEMO-2] \\ ---- [Learn more about issues|https://confluence.atlassian.com/display/JIRA/What+is+an+Issue] \\

How can I use AJS to format this,or the JiraAPI to do this?

regards

chris

2 answers

This widget could not be displayed.

Javascript/Jquery

AJS.$(#description-val).text() will grab the description of an issue. you can trim() to remove white space. Obviously this is javascript so should be once page loads.

API

https://host:port/rest/api/2/issue/{issueid}

which will return your issue in json. Then you can assign it to a variable in javascript i.e. :

function getDescription()

{

var description;

AJS.$.ajax({

url: "/jira/rest/api/2/issue/TEST-1",

type: 'get',

dataType: 'json',

async: false,

success: function(data) {

description = data.fields['description'];

}

});

return description;

}

Hello, thanks for that, but this is not what I search.
I want to format it too pretty looking HTML, not the Meta or whatever this is.

This widget could not be displayed.

Hello, thanks for that, but this is not what I search.
I want to format it too pretty looking HTML, not the Meta or whatever this is.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

28 views 3 4
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you