On click event I am trying to get the data from XML as per the click object's attr() value

On click event I am trying to get the data from XML as per the click object's attr() value

On click event I am trying to get the data from XML as per the click object's attr() value.

Below I have placed two hyperlink buttons and a container for input the data. Both are having different attr() value.

So I want to get the data according to these hyperlink's attr() value.

Even I have created a XML with respective nodes.But unable to get the exact data. 

Can anyone please helpppp?

here is the HTML, JS and XML code:

HTML Code:

<div id="uiWrapper"></div>
<a class="readmore" href="mark">mark</a>
<a class="readmore" href="source">source</a>


JS Code:


$(function() {

$('a.readmore').click(function() {

var container = $('#uiWrapper');

$.get('myxml3.xml',function(data){

container.empty();

$(data).find('sector').each(function(){

var $tag = $(this), 

getName = $('a.readmore').attr('href');

var html = '<div class="data">';  

html += '<div class="tagDetail">' + $tag.find('description').text() + '</div>';

html += '</div>';

if($tag.attr('name') == getName){

container.append(html);

}else{

return false;

}

});   

});

return false;

});

});


XML Code:


<?xml version="1.0" encoding="utf-8" ?>

<sections>


  <sector name="mark">

  <description>Mark Text is coming</description>

  </sector>

  

  <sector name="source">

  <description>Source Text is coming</description>

  </sector>

 

  

</sections>