0

I need to access some TD values in a TABLE that is in another HTML file. I am not really sure what way helps me get a working solution for this. Currently I want to access it using jquery. All I imagine for solving this issue is to load the whole external HTML file into a DIV in my main file and seek through the TDs to find my favorite one and print its content to my main TABLE TD. I do not seem to be able to figure it out. please help me with this! My main PHP file:

<?php
...
...
$loading_transmitter = $_POST['transmitter']; 
?> 
<script>  
$("#result").load('<?php echo $loading_transmitter; ?>',function(){
    var main_proc_temp = $(table:nth-child(2).tr:nth-child(1).td:nth-child(3)).text();#table loaded from the external file
    alert(main_proc_temp);#it should alert: "OK" but alets: "Undefined"
});
</script>

Is the content of the loaded file available this way? Because after loading it on the page (which goes well), I checked the source code and found out that the result div is yet empty.

2 Answers 2

1

I think you don't have tr and td class so remove the . from the selectors then check.

Also you should find your table in your responselike,

like,

$("#result").load('<?php echo $loading_transmitter; ?>',function(data){
    var main_proc_temp = $(data).find('table:nth-child(2) tr:nth-child(1) td:nth-child(3)').text();
    alert(main_proc_temp);
});
Sign up to request clarification or add additional context in comments.

Comments

0

If you're using PHP, can you not write these values to a database as they change and access them that way?

1 Comment

well, the main problem is currently ACCESSING THESE VALUES, the values are in a built-in HTML file that are readonly for some communication transmitters!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.