Running ajax request with cell link not working.

Running ajax request with cell link not working.

jigar311982jigar311982 Posts: 70Questions: 31Answers: 0

Hello,

I have created cell link with below code,

                {
                    targets: 1,
                    render: function(data, type, full, meta) {
                        return '<a href="#" class="viewVendorButton">'+ data +'</a>';
                    },
                },

and then i am using below code on click button to pull html from server,

        $(".viewVendorButton").on('click', function() {         
            jQuery.ajax({
                url: "/purchases/renderviewvendor",
                type: "POST",
                success:function(data){
                    $data = $(data); // the HTML content that controller has produced
                    $('#vendorformcontainer').hide().html($data).fadeIn();
                    $('.selectpicker').selectpicker();
                    _SaveVendor();
                }
            });
        });

Problem is that it is not fetching my HTML, in short anything happens on clicking on target 1.

If i use normal button like below code, it easitly fetch HTML,

 <a href="#" class="btn btn-danger font-weight-bolder viewVendorButton"></a>

Not sure why cell link for working for AJAX call, normal link to another page is working fine.

Answers

This discussion has been closed.