JavaScript how to set dynamic data to other html from ajax success

I have an ajax success response from one html but I want to set dynamic data of this ajax response to another how do I do that here is my ajax report

    success: function(data) {
        console.log(data);
        for (var i=0; i<data.data.length;i++)
        {
            $("#eng-jobs").append('<tr id="enginner-job'+[i]+'" class="price-table">' +'<td class="colspan-4">' + '<a target='_blank' href="job.html" class="title">' +data.data[i].job_name+'</a>' +'</td>' + '<td class="colspan-4">' + '<a target='_blank' href="job.html" class="location">' +data.data[i].location+'</a>' +'</td>' + '</tr>' );
        }
        window.location="enginnering.html";
    }
});

this will generate a dynamic table now I want to set this table in other html where I have put my code like

<table class="table table-striped">
    <thead style="display: table-header-group;">
        <tr>
            <td class="colspan-4">Position</td>
            <td class="colspan-4 location-head">Location</td>
        </tr>
    </thead>
    <tbody id="eng-jobs">
        <!-- Table Body Data -->
    </tbody>
</table>

but I got nothing Any help please

Answer:1

Try using localStorage , removing brackets "[" "]" from string setting id

At "engineering.html"

$(document).ready(function() {
  var data = JSON.parse(localStorage.getItem("data"));
  // do stuff with `data`
})

at success

    success: function(data) {
        console.log(data);
        localStorage.setItem("data", JSON.stringify(data));
        for (var i=0; i<data.data.length;i++)
        {
            $("#eng-jobs").append('<tr id="enginner-job'+ i +'" class="price-table">' 
            + '<td class="colspan-4">' 
            + '<a target='_blank' href="job.html" class="title">' +data.data[i].job_name+'</a>' 
            + '</td>' 
            + '<td class="colspan-4">' 
            + '<a target='_blank' href="job.html" class="location">' + data.data[i].location
            + '</a>' 
            + '</td>' 
            + '</tr>' );
        }
        window.location = "enginnering.html";
    }
});
Answer:2

I'm looking at a node.js library (gen-readlines) that reads large flat files via a generator - i.e. a file is read in 'chunks' of 65 536 bytes at a time via a generator. Not having a CS background I ...

I'm looking at a node.js library (gen-readlines) that reads large flat files via a generator - i.e. a file is read in 'chunks' of 65 536 bytes at a time via a generator. Not having a CS background I ...

I have an app that runs in the client browser and doesn't have any server side (http/js is served, but nothing posts to the server). the app is redeployed on many servers (iis, apache, nginx, ...

I have an app that runs in the client browser and doesn't have any server side (http/js is served, but nothing posts to the server). the app is redeployed on many servers (iis, apache, nginx, ...

I wrote a Fibonacci Sequence javascript solution. I was able to push out a Fibonacci Sequence array. However, this solution add an extra number in the array that is more than the limited number. For ...

I wrote a Fibonacci Sequence javascript solution. I was able to push out a Fibonacci Sequence array. However, this solution add an extra number in the array that is more than the limited number. For ...

  1. limit fibonacci sequence

So we know that the action attribute used for sending the form data to a web server. But I have a couple of questions: If the action attribute is not set, why does it reload the page by default? ...

So we know that the action attribute used for sending the form data to a web server. But I have a couple of questions: If the action attribute is not set, why does it reload the page by default? ...

  1. form without action php
  2. form without action html
  3. form without action javascript
  4. form without action attribute
  5. form without action submit
  6. form without action
  7. form without action and method
  8. form without action parameter
  9. form action without redirect
  10. form action without reloading page
  11. form action without submit button
  12. form action without refresh
  13. form action without leaving page
  14. form action without button
  15. form tag without action
  16. form post without action
  17. html5 form without action
  18. html form without action attribute
  19. submit form without action javascript
  20. form tag without action attribute