Hello everybody, I have a problem with jQuery and XML. I am using jQuery to load data from a XML file. It works fine but I want to show data follow list format with its title , when I click the title the info of its will show. How can I do it?
My code:
$(document).ready(function(){
$.ajax({
type: "GET",
url: "xml/tuyendung.xml",
dataType: ($.browser.msie) ? "text" : "xml",
success: function(xml) {
var newXML = parseXml(xml);
$(newXML).find('TDDetail').each(function(){
var emailid = $(this).attr('email');
var tdcode = $(this).attr('tdcode');
var title = $(this).find('jobtitle').text();
var position = $(this).find('positiontitle').text();
var jobdescribe= $(this).find('jobdescribe').text();
var jobexperience= $(this).find('jobexperience').text();
var jobskills= $(this).find('jobskills').text();
var jobtime= $(this).find('jobtime').text();
var joblocation= $(this).find('joblocation').text();
var jobcategory= $(this).find('jobcategory').text();
var joblevel= $(this).find('joblevel').text();
var jobsalary= $(this).find('jobsalary').text();
var ecount=0;
matd=new Array();
if($(this).attr('email')==GetCookie('Email') && tdcode==tdcode )
{
$('<div class="items" id="link_'+tdcode+'"></div>').html('<a href="javascript:hienthi()">'+title+'</a>').appendTo('#textb');
}
});
}
});
});
and my XML file:
<?xml version="1.0"?>
<TD>
<TDDetail email="[email protected]" tdcode="TD001" jobtitle="quan ly">
<jobtitle>Quan ly</jobtitle>
<positiontitle>Manager</positiontitle>
<jobdescribe>Quan ly nhan su cong ty ABC</jobdescribe>
<jobexperience>2</jobexperience>
<jobskills>Anh van giao tiep tot. Chung chi tin hoc B</jobskills>
<jobtime>Fulltime</jobtime>
<joblocation>CanTho</joblocation>
<jobcategory>IT-Software</jobcategory>
<joblevel>Manager</joblevel>
<jobsalary>thoa thuan</jobsalary>
</TDDetail>
<TDDetail email="[email protected]" tdcode="TD002" jobtitle="quan ly ma">
<jobtitle>Quan ly ma</jobtitle>
<positiontitle>Manager</positiontitle>
<jobdescribe>Quan ly nhan su cong ty ABC</jobdescribe>
<jobexperience>2</jobexperience>
<jobskills>Anh van giao tiep tot. Chung chi tin hoc B</jobskills>
<jobtime>Fulltime</jobtime>
<joblocation>CanTho</joblocation>
<jobcategory>IT-Software</jobcategory>
<joblevel>Manager</joblevel>
<jobsalary>canh tranh</jobsalary>
</TDDetail>
<TDDetail email="[email protected]" tdcode="TD003" jobtitle="giam doc">
<jobtitle>Giam Doc Van Phong</jobtitle>
<positiontitle>Manager</positiontitle>
<jobdescribe>Quan ly nhan su cong ty ABC</jobdescribe>
<jobexperience>2</jobexperience>
<jobskills>Anh van giao tiep tot. Chung chi tin hoc B</jobskills>
<jobtime>Fulltime</jobtime>
<joblocation>CanTho</joblocation>
<jobcategory>IT-Software</jobcategory>
<joblevel>Manager</joblevel>
<jobsalary>compete</jobsalary>
</TDDetail>
<TDDetail email="[email protected]" tdcode="TD003"><jobtitle>Giao hang</jobtitle><positiontitle>employee</positiontitle><jobdescribe>Tuyen nhan vien gio hang trong noi thanh Can Tho</jobdescribe><jobexperience>0</jobexperience><jobskills>Lanh le , gioi viec</jobskills><jobtime>Parttime</jobtime><joblocation>CanTho</joblocation><jobcategory>Sale</jobcategory><joblevel>graduate</joblevel><jobsalary>thoa thuan</jobsalary></TDDetail></TD>