Very new to jquery so if my question is a bit out there then my apologies.
I am playing around with $.get
From.htm:
<body>
<span id="Mytest">Hello</span>
</body>
index.htm:
<body>
<span id="Mytest1">BBBBBBB</span>
<script>
$.get('From.htm #Mytest', function(data) {
if (data) {
$('#Mytest1').html(data).innerHTML);
};
});
</script>
</body>
The above works perfectly. The inner html of #Mytest1 gets changed to Hello.
But what I would like is to have $(‘#Mytest1’).html(data).innerHTML); as a string to test the data before I write it to #Mytest1.
I have tried several things but I am just not getting there. I think I have done ok so far. If anyone can help that would be great.
I have tried looking at “data” (alert(data)) but if I alert it-it shows the whole From.htm page. Might be doing something wrong there.
Thank you for your help.
you can modify your code as below
There is no need of innerHtml ,
Please let me know if you need any more info.