How To show javascript data in wordpress
-
Hello,
I want to add my code in WordPress and it is a custom code built on html and javascript but It is not showing the value in WordPress. The code is attached below.
Kindly help me with how can I show the live values on WordPress.
Thanks———————–Code———————-
<!DOCTYPE html> <html> <head> <title>Live Rates</title> <!-- Include Bootstrap CSS --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"> </head> <body> <div class="container"> <h1>Live Rates</h1> <table class="table"> <thead> <tr> <th scope="col">#</th> <th scope="col">Name</th> <th scope="col">Price</th> </tr> </thead> <tbody id="tbody"> </tbody> </table> </div> <!-- Include Bootstrap JS (optional, for additional functionality) --> <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script> <script src="https://code.jquery.com/jquery-3.7.0.js" integrity="sha256-JlqSTELeR4TLqP0OG9dxM7yDPqX1ox/HfgiSLBj8+kM=" crossorigin="anonymous"></script> <script> $(document).ready(function () { function getRates(){ // $('#tbody').html(null); $.ajax({ type: "GET", url: "https://bcast.classicbullion.com:7767/VOTSBroadcastStreaming/Services/xml/GetLiveRateByTemplateID/classic?_=1687801341693", dataType: 'text/plain', success: function (result) { console.log(result); }, error: function (err) { var response = err.responseText; var rows = response.split('\n'); var dataArray = []; $.each(rows, function (index, row) { var values = row.split('\t'); dataArray.push(values); }); var tableBody = $('#tbody'); // var data; $.each(dataArray, function (index, rowData) { // tableBody.html(null); var row = $('<tr>'); $.each(rowData, function (key, value) { // console.log('value', value) if(value){ var cell = $('<td>').text(value); row.append(cell); } }); tableBody.html(row); }); // alert(err.responseText); } }) } setInterval(getRates,1000); }) </script> </body> </html>
The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How To show javascript data in wordpress’ is closed to new replies.