0

How to get content from an iframe with header content-type: text/plan?

Is it possible to load the content with $.ajax() without reloading the content?

iframe content:

{"result":{"posts":0,"posts_imported":0},"error":{"file":{"msg":"ERR_ERROR_FILE","trans":{"file":"csv"}}}}
clarkk
  • 25,706
  • 67
  • 182
  • 315

2 Answers2

0

In Jquery :

var content = $("iframe").contents();
Aelios
  • 11,221
  • 2
  • 35
  • 53
-1

How about:

your iframe html file:

a div

<div id='iframeContent'>
    {"result":{"posts":0,"posts_imported":0},"error":{"file":{"msg":"ERR_ERROR_FILE","trans":{"file":"csv"}}}}
</div>

then your code to replace it would be, I believe,

$('your-iframeid').childen('<div>',0).text(your-new-text);

I am a beginner; so, I might be completely off on this one (too).

Emre Erkan
  • 8,372
  • 3
  • 49
  • 53
zequinha-bsb
  • 719
  • 4
  • 10
  • Make sure to indent any code like HTML, javascript, etc. 4 spaces in - or use the Code toolbar button (looks like "{}"). – GregL Oct 31 '11 at 00:04