dynamic url in jquery UI , datatable

dynamic url in jquery UI , datatable

avi@aruneshavi@arunesh Posts: 8Questions: 3Answers: 0

i have an jquery application which perform a get request and populate the jquery data table .

the url (whole url) will be passed by the client application , i 've to catch the url and proceesed i.e. making a get request and populating the data table.

the data table is in a jquery ui dialogue.

the client will click on a button and it'll open the UI dialogue box which contains the data table, the url will be passed by the button.

i want to catch the url in js and passed it in ajax request ..like in the code below.

thanks in advance.

here is my code :-

$(document).ready(function() {

                $("#notesDialog").dialog({
                    autoOpen : false,
                    title : "Notes",
                    hide : "",
                    width : 'auto',
                    height : 'auto',
                    modal : true
                });


                var table = $('#notesTable').dataTable({

                        bJQueryUI : true,
                        "processing" : true,
                        "serverSide" : true,
                        "contentType" : "application/json",
                        "dataType" : "jsonp",
                        "bStateSave" : false,
                        "bAutoWidth" : false,
                        "sAjaxSource" : "url",
                        "sAjaxDataProp" : '',
                        "crossDomain" : true,
                        "aoColumns" : [
                                {
                                    "mData" : "onBoarded",
                                    "sWidth" : "20%",
                                    "mRender" : function(data,type, full) {
                                    var newStr = new Date(data).toUTCString();
                                    var str = newStr.substring(0,newStr.length - 3);
                                    return str.substring(4);

                                    }
                                },
                                {
                                    "mData" : "createdBy"
                                },
                                {
                                    "mData" : "comment",
                                    "mRender" : function(data,type, full) {
                                    var showChar = 50;
                                    var ellipsestext = "...";
                                    var moretext = "more";
                                    var lesstext = "less";
                                    var contentt = JSON.stringify(data);
                                    var content = contentt.replace(/["]+/g,'').substring(1,contentt.length - 1);

                                    if (content.length > showChar) {

                                        var c = content.substr(0,showChar);
                                        var h = content.substr(showChar - 1,content.length- showChar);

                                        var html = c
                                                + '<span class="moreellipses">'
                                                + ellipsestext
                                                + '&nbsp;</span><span class="morecontent"><span>'
                                                + h
                                                + '</span>&nbsp;&nbsp;<a href="" class="morelink">'
                                                + moretext
                                                + '</a></span>';

                                        return html.toString();
                                    }

                                    $(".morelink").click(function() {
                                                if ($(this).hasClass("less")) {
                                                            $(this).removeClass("less");
                                                            $(this).html(moretext);
                                                        } else {
                                                            $(this).addClass("less");
                                                            $(this).html(lesstext);
                                                        }
                                                        $(this).parent().prev().toggle();
                                                        $(this).prev().toggle();
                                                        return false;
                                                    });

                                    return data;
                                }
                            }, {
                                "mData" : "tag"
                            } ]

                });



$("#opener").click(function() {
$("#notesDialog").dialog("open");

$('#notesDialog').dialog("widget").position({

    });
    });

});

This discussion has been closed.