Esh
Esh

Reputation: 856

jquery - <a> tag created in jquery

I am a newbie for jquery and I dont know how to get the text of an tag created using Jquery.

I want to send that value to the server using Jquery as request to get values from the database.

$(document).ready(function() {
    $.ajax({
        type: "GET",
        url: "newxml.xml",
        dataType: "xml",
        success: function(xml) {
            var name ;
            var lname;
            var email;
            var city;
            //document.write("<table>");
              var $tbl = $('#basicTable');
            $(xml).find('Details').each(function(){
                 $tbl.append($('<tr>').append(
                         $('<td>').text($(this).find('name').text()),
                         $('<td>').text($(this).find('LastName').text()),
                         $('<td>').text($(this).find('City').text()),
                         $('<td>').html("<a href='//www.google.com' >"+$(this).find('Email').text()+"</a>")
                         ));
            }); 
            $('#tableWrap').append($tbl);
            $('#basicTable').dataTable();

    }
    });

}); 

Upvotes: 2

Views: 154

Answers (1)

Philemon philip Kunjumon
Philemon philip Kunjumon

Reputation: 1422

use .html() instead of .text()

hope this will help you..

Upvotes: 3

Related Questions