On Wed, Aug 25, 2010 at 9:39 AM, Otis Rothenberger <[email protected]>wrote:

>  Bob,
>
> I didn't think of AJAX, probably because I'm at the low end of the learning
> curve on that. My server is limited to ASP.NET, but that should work with
> the approach you suggest.
>
> Am I correct on the following assumption? To use AJAX in place of the
> iFrame, I would have to write the NIH data to a temp text file on my server.
> Then AJAX could access that text file without a JavaScript security
> violation. Am I on the right track with this thought?
>
>
You just have your server return the file as part of a web call, just like
any "GET". The AJAX part is that you don't have to load that page into a
frame, you just use an asynchronous call. It's not really "xml" data -- just
HTML, but that's the name of the function that was developed back when they
THOUGHT it was going to be used for XML.


var req = null
var isMSIE = false

function loadXmlData(url, data, processor) {
    xmlProcessor = processor
    try {
        if (window.XMLHttpRequest) { // native XMLHttpRequest object
            req = new XMLHttpRequest();
        } else { // IE/Windows ActiveX version
            isMSIE = true
            req = new ActiveXObject("Microsoft.XMLHTTP");
        }
        req.onreadystatechange = processStateChange;
        req.open("POST", url + "?" + data, true);
        req.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded; charset=UTF-8');
        req.send(data);
    } catch (e) {
        alert(e);
    }
}



function processStateChange() {
    if (req.readyState != 4)
        return
    if (req.status != 200) {
        alert(req.statusText);
        return
    }
   [do something with req.responseText]
}



Bob


> Other Questions: What I'm doing at present is reading the NIH data into a
> dynamic page that resides on my server. This dynamic page is loaded to the
> iFrame so that I can use the data. Can I use AJAX to read this dynamic page
> and bypass the iFrame? I should note that a call to the dynamic page must
> have the appropriate query string that triggers the appropriate NIH data
> read. I've used AJAX to read static files. Is the current problem that
> simple?
>
>
that simple.  Way easier.


> Otis
>
> Otis Rothenbergerchemagic.com
>
>
> On 8/25/2010 9:54 AM, Robert Hanson wrote:
>
> Otis, you can use an "applet proxy" -- that is, a stub of code on your web
> site that relays the data from another site, which is basically what you
> seem to be using.
>
> In addition, there is a JavaScript server at St. Olaf that allows you to
> read a page from anywhere in the world into the unsigned Jmol applet. You
> can use that. Check Jmol.js to see how that is used -- the unsigned applet
> can read from the American Mineralogist or RCSB this way. I don't advertise
> it because it's a browser version headache. The key for that is that it uses
> a JavaScript link.
>
> Actually, though, if you have access to your own site and php, you should
> use AJAX - that's what it's for. Get rid of the iframe!
>
> I'm trying to think of a good example where I have used that....
>
> Bob
>
>
> On Wed, Aug 25, 2010 at 12:21 AM, Otis Rothenberger <[email protected]
> > wrote:
>
>>
>> Otis
>>
>> --
>> Otis Rothenberger
>> chemagic.com
>>
>>
>
>
> ------------------------------------------------------------------------------
> Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
> Be part of this innovative community and reach millions of netbook users
> worldwide. Take advantage of special opportunities to increase revenue and
> speed time-to-market. Join now, and jumpstart your future.
> http://p.sf.net/sfu/intel-atom-d2d
> _______________________________________________
> Jmol-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>


-- 
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to