Hi Eric....thanks...I am sure we are really close...but I cant get it to 
work..... seems the onclick is not firing.... the code I am testing is -

<html><iframe src="AAA/testMysql.php" id="testMYSQL" 
style="width:100%;height:200px;"></iframe>
<a href="javascript:void(0)" onclick="
var frame=this.previousSibling;
var txt=frame.contentDocument.body.innerHTML;
localStorage.mysql=txt;
">check this out!</a></html>
<<wikify {{localStorage.mysql}}>>

..for now I am just putting the txt into a localStorage so I can quickly 
see if it worked...

the php code is returning the text...but clicking the link does do 
anything....

note that the TW where this code is embedded is on the same domain as the 
php script....hence the reletaive link!

Why does this code work?

Thanks
Skye

Em quarta-feira, 13 de novembro de 2013 15h47min55s UTC-3, Eric Shulman 
escreveu:
>
> On Wednesday, November 13, 2013 10:09:11 AM UTC-8, skye riquelme wrote:
>
>> Thanks......as I said, the link returns the data....and I can format the 
>> output into JS code or whatever......but the result of the link is that the 
>> data is returned to window/tab where the TW is open...  losing the 
>> TW.....my question is how receive the data from the php link...into a 
>> tiddler...and not into a new window?
>>
>
> You were correct to direct the PHP output to a target IFRAME.  The trick 
> is to gain access to the contents of that IFRAME once it is loaded with 
> results.  One problem is that there's no *automatic* way to know when the 
> results are ready.  A work-around is to use a link, immediately following 
> the IFRAME, that can be clicked once the user observes that results are 
> visible in the IFRAME.  The link then accesses its "previous sibling" (the 
> IFRAME), and reaches into the "contentDocument.body" to fetch the 
> "innerHTML" of the results (in your use-case, just plain text).
>
> One other problem: browser restrictions on "same protocol" and/or "same 
> domain" access to IFRAMES.  Depending upon your particular use case, you 
> might be able to work around this by putting your TW and the PHP script on 
> the same server.
>
> Here's some HTML that demonstrates the basic syntax for access the 
> IFRAME's text content
> -----------------------
> <html><iframe src="..." style="width:100%;height:200px;"></iframe><a 
> href="javascript:;" onclick="
> var frame=this.previousSibling;
> var txt=frame.contentDocument.body.innerHTML;
> // now that you have the 'txt' in a variable, you can parse/modify that 
> text
> // and then call on store.saveTiddler(...,txt,...) to copy the text to a 
> tiddler
> ">save data to tiddler</a></html>
> -----------------------
>
> enjoy,
> -e
> Eric Shulman
> TiddlyTools / ELS Design Studios
>
> HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...
>    http://TiddlyTools.github.com/fundraising.html#MakeADonation
>
> Professional TiddlyWiki Consulting Services...
> Analysis, Design, and Custom Solutions:
>    http://www.TiddlyTools.com/#Contact
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to