0

I want to show XML string in the HTML table using jquery.

here is my jquery code

 <script type="text/javascript">
    $(document).ready(function () {
        //alert("dsfd");
        var vill = "FE438A26-F985-DC11-BAB5-000E0CA4A31A";
        var teh = "164";
        var khr = "243//4";

        $.ajax({
            url: 'http://__link__/GisWebService.asmx/GisWebService',
            data: { village_id: vill, tehsil_id: teh, khasra_no: khr },
            method: 'post',
            datatype: 'xml',
            success: function (data) {
                var a = new XMLSerializer().serializeToString(data);
                alert(a);
               
            },
            error: function (err) {
                alert(err);
            }
        });
    });
</script>

The below image shows an XML string in alert which gets from the web service

enter image description here

I want to display the content of this XML string in HTML table like:

khewat_no         Column1                                          owner_share
34                ਜਗਰੂਪ ਸਿੰਘ ਪੁੱਤਰ ਪ੍ਰਿਥਾ ਸਿੰਘ ਪੁੱਤਰ  ਸਾਧੂ ਸਿੰਘ vbcrlf       80/913
34                ਗੁਰਮੀਤ ਸਿੰਘ ਪੁੱਤਰ ਮਹਿੰਦਰ ਸਿੰਘ ਪੁੱਤਰ  ਸਾਧੂ ਸਿੰਘ vbcrlf     57/1826


Nimantha
  • 5,793
  • 5
  • 23
  • 56
  • That XML file contains JSON, which is a ***really*** weird way of doing things. I would suggest you return JSON directly instead of wrapping it in XML for no reason. With regard to your goal, get the JSON from the XML, then deserialise the JSON, then use it to build a table, something like this: https://stackoverflow.com/a/17724264/519413 – Rory McCrossan Jul 15 '21 at 16:27

0 Answers0