Top add

Jquery to read from xml

  1. Include the jquery in your page
  2. Validate the xml using online xml validators
  3. Use the jquery.get() to get all the data from the xml
    example:
    $('Contact',xml).each(function() {
    srno = parseInt($(this).find("srno").text());
    empId = $(this).find("empid").text();
    name = $(this).find("name").text();
    contact = $(this).find("contact-data").text();
    type = $(this).find("type").text(); }

  4. The xml data are read and shown as html using jquery
  5. To add new date use the function $('#idSave').click() to delete use deleteRow and to edit editrow
Download the source file here . Files has custom.js which has add/edit and delete function . Please run contact.html to see the output



No comments: