OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Ajax Response Html with html download links not working and other issue

  • Thread starter Thread starter Val
  • Start date Start date
V

Val

Guest
I'm absolutely not expert on js and html, following the answers and samples of stackoverflow I found a way to publish on my website a external html source. In the external source there are present some link to download csv files, in the original page the links works correctly in the ajax responce is not possible to download these files. I have read many posts on a possible solution but I was unable to understand how to apply the proposed solutions. Another problem is a DIV that I tried to remove through the .remove () instruction without success (always following some posts found).

Div I want to display with download links clientArea Div I want to remove buttons

Following a part of external html, the single html DIV in my webpage and the script i'm using (i removed the instruction .remove())

Thanks..

HTML

Code:
  </head>
  <body>
  <div id="**clientArea**">

    <div id="titleArea">
    <h1>Log di dati</h1>
      <div class="updatable Title_Area_Selectbox" id="filebrowser_selectbox">

      </div>
      <div id="**buttons**">
      <span id="dynamic_link">
      <a class="Link_ReloadIcon" href="../ReloadSite.mwsl">
      <img height="13" title="Aggiorna" alt="Refresh" src="../Images/ICO_WEB_refresh.gif">
      </a>
      </span>
      <a class='PrinterIcon_Active' href='../Portal/Print.mwsl?PriNav=DataLogs' target=_blank>&nbsp;
      <img title="Stampa" style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; HEIGHT: 13px" height="13" alt=Print src="../Images/ICO_WEB_Drucken.gif">
      </a>
      </div>

  </div>
    <div id="separatorLine3"></div>
      <table id="DataLogsError"><tr><td class="Error_Message"></td></tr></table>
      <div class="updatable" id="FilebrowserTable">
      <table class="ContentTable">
      <tr>
        <td id="File_Name" class="ContentTableField_1">Nome</td>
        <td id="File_Size" class="ContentTableField_1">Dimensione</td>
        <td id="File_Dates" class="ContentTableField_1">Modificato il</td>
        <td id="File_Status" class="ContentTableField_1">Attivo</td>
        <td id="File_Delete" class="ContentTableField_1">Cancella</td>
        <td class="Filebrowser_No_Sort_Header"><span class="nobr">Recupera e cancella</span></td>
      </tr>
      <tr>
      <td class='ContentTableField'>**<a href='/DataLogs?Path=/DataLogs/Mer.csv&amp;Action=DOWNLOAD'>Mer.csv</a>**
    </td>
    <td class="ContentTableField_Filesize"><span class="nobr">5,08 KB</span></td>
    <td class="ContentTableField"><span class="nobr">18:10:00   26.06.2024</span></td>
    <td class="ContentTableField">No</td>

...
  </body>
</html>

IN MY WEBPAGE

Code:
<Div id="**DataLog**"></Div>

SCRIPT IN MY WEBPAGE

Code:
    <script type="text/javascript">
        $(document).ready(function() {
            $(function() {
              $.ajax({
                url:"/Portal/Portal.mwsl?PriNav=DataLogs",
                type:"GET",
                dataType:'html',
                success:function(data) {
                  var out = "";
                  $(data).find("#**clientArea**").each(function(loop, item){out += $(item).html();});
                  data = out;
                  alert(data);
                 $("#**DataLog**").html(data);
              }                  
            })
        });
        });
    </script>
<p>I'm absolutely not expert on js and html, following the answers and samples of stackoverflow I found a way to publish on my website a external html source. In the external source there are present some link to download csv files, in the original page the links works correctly in the ajax responce is not possible to download these files.
I have read many posts on a possible solution but I was unable to understand how to apply the proposed solutions.
Another problem is a DIV that I tried to remove through the .remove () instruction without success (always following some posts found).</p>
<p>Div I want to display with download links <strong>clientArea</strong>
Div I want to remove <strong>buttons</strong></p>
<p>Following a part of external html, the single html DIV in my webpage and the script i'm using (i removed the instruction .remove())</p>
<p>Thanks..</p>
<p><strong>HTML</strong></p>
<pre><code> </head>
<body>
<div id="**clientArea**">

<div id="titleArea">
<h1>Log di dati</h1>
<div class="updatable Title_Area_Selectbox" id="filebrowser_selectbox">

</div>
<div id="**buttons**">
<span id="dynamic_link">
<a class="Link_ReloadIcon" href="../ReloadSite.mwsl">
<img height="13" title="Aggiorna" alt="Refresh" src="../Images/ICO_WEB_refresh.gif">
</a>
</span>
<a class='PrinterIcon_Active' href='../Portal/Print.mwsl?PriNav=DataLogs' target=_blank>&nbsp;
<img title="Stampa" style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; HEIGHT: 13px" height="13" alt=Print src="../Images/ICO_WEB_Drucken.gif">
</a>
</div>

</div>
<div id="separatorLine3"></div>
<table id="DataLogsError"><tr><td class="Error_Message"></td></tr></table>
<div class="updatable" id="FilebrowserTable">
<table class="ContentTable">
<tr>
<td id="File_Name" class="ContentTableField_1">Nome</td>
<td id="File_Size" class="ContentTableField_1">Dimensione</td>
<td id="File_Dates" class="ContentTableField_1">Modificato il</td>
<td id="File_Status" class="ContentTableField_1">Attivo</td>
<td id="File_Delete" class="ContentTableField_1">Cancella</td>
<td class="Filebrowser_No_Sort_Header"><span class="nobr">Recupera e cancella</span></td>
</tr>
<tr>
<td class='ContentTableField'>**<a href='/DataLogs?Path=/DataLogs/Mer.csv&amp;Action=DOWNLOAD'>Mer.csv</a>**
</td>
<td class="ContentTableField_Filesize"><span class="nobr">5,08 KB</span></td>
<td class="ContentTableField"><span class="nobr">18:10:00 26.06.2024</span></td>
<td class="ContentTableField">No</td>

...
</body>
</html>
</code></pre>
<p><strong>IN MY WEBPAGE</strong></p>
<pre><code><Div id="**DataLog**"></Div>
</code></pre>
<p><strong>SCRIPT IN MY WEBPAGE</strong></p>
<pre><code> <script type="text/javascript">
$(document).ready(function() {
$(function() {
$.ajax({
url:"/Portal/Portal.mwsl?PriNav=DataLogs",
type:"GET",
dataType:'html',
success:function(data) {
var out = "";
$(data).find("#**clientArea**").each(function(loop, item){out += $(item).html();});
data = out;
alert(data);
$("#**DataLog**").html(data);
}
})
});
});
</script>
</code></pre>
Continue reading...
 

Latest posts

Z
Replies
0
Views
1
zuegelwagen
Z
Top