2016-04-19 12 views
0

getリクエストを実行してjQueryデータテーブルを作成するjQueryアプリケーションがあります。jQuery UIの動的URL、データテーブル

URL(全URL)はクライアントアプリケーションから渡されます。このURLを読み込んで同じ処理、つまりjQuery.get()リクエストを作成してデータテーブルを作成する必要があります。データテーブルはjquery UIダイアログにあります。

クライアントがボタンをクリックすると、データテーブルを含むUIダイアログボックスが開き、URLがボタンに渡されます。

私はjsのURLをキャッチして、以下のコードのようにAJAXリクエストで渡したいと思います。

ありがとうございます。ここ

は私のコードです: -

$(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({ 

     }); 
     }); 

}); 

答えて

0

あなたの現在のURLを取得したいですか?

あなたはあなたのウィンドウの現在のURLを取得するために

window.location.href 

を使用することができます。

+0

"sAjaxSource":window.location.href ---このようにしますか? –

+0

実際には、URLはクライアントによって渡されます。現在のページのウィンドウURLではなく、何でもかまいません。 – avi

+0

asp.netまたはmvcを使用していますか? –

関連する問題