Save value from iframe to KM variables

How are you all? :smiley:

I am using JS script to save KM variables.

<p class="input1"><textarea class="txta3" id="salary" rows="3" cols="100">00000</textarea></p>

However, there is a iframe in the textarea field.

<p class="input1"><iframe class="txta3" id="content" width="720" height="300" src="/source.php?a="></iframe></p>

source.php outputs some HTML code.

Is there anyway to save the iframe HTML code?

(function() {
return document.querySelector('#content').value;
})(); 

This is not working.

Thank you all the time. :slight_smile:

I have changed from iframe to Ajax and solved :slight_smile:

Thank you!

1 Like

What's the code?

Heeeyyyy. :smiley: How are you doing, @ccstone ?
Long time no see. :slight_smile: Remember me? you helped me a lot and also learned a lot from you.
Ajax is just much better than iframe.. and works fine.

I am trying to solve another problem and found one of your answers.. and almost solved. hehe.

Thank you!! all the time!!

1 Like
<div id="content_ajax"></div>
<script type='text/javascript'>
$(document).ready(function (){
var pid = document.querySelector('#post_id').value; // Get the post id. you don't need if you have to pass.

$('#content_ajax').load('posts.php?pid='+pid); // you don't need if post id is not needed.
});
</script>

After that I used the same code.

(function() {
return document.querySelector('#content_ajx').value;
})(); 

I think I understand what you mean :slight_smile: to leave the solution to help others.

Thank you again!!!

1 Like