SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 61 | Next

Thomas Powell

"Ajax: The Complete Reference"

In fact, just about any tag that references an external URL can be used. For
example, inline frames, as defined by the
Now find this tag using a DOM call and set its src value to the server-side program
that should be invoked along with a query string containing the data to be transmitted.
var ifr = document.getElementById("hiddenIframe");
ifr.setAttribute("src",url);
It isn??™t necessary to preload the iframe into the page, the DOM can be used to insert it
dynamically. The following rewrite of the sendRequest function replicates the previous
image-based communication rating example but uses DOM inserted inline frames instead:
function sendRequest(url,payload)
{
var ifr = document.createElement("iframe");
ifr.style.visibility="hidden";
document.body.appendChild(ifr);
ifr.src = url+"?"+payload; // set src last to avoid double fetch
}
When you run the example (http://ajaxref.com/ch2/onewayiframeget.html), notice that
your browser will likely show an indication of network activity, which may not be desirable.


Pages:
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73