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 89 | Next

Richard Wagner

"Professional iPhone and iPod touch Programming: Building Applications for Mobile Safari"

responseText);
else
{
var frag = document.createElement(???div???);
frag.innerHTML = req.responseText;
iui.insertPages(frag.childNodes);
}
if (cb)
setTimeout(cb, 1000, true);
}
};
if (args)
{
req.open(method || ???GET???, href, true);
req.setRequestHeader(???Content-Type???, ???application/x-www-formurlencoded???);
req.setRequestHeader(???Content-Length???, args.length);
req.send(args.join(??? & ???));
}
else
{
req.open(method || ???GET???, href, true);
req.send(null);
}
}
The routine calls XMLHttpRequest() to assign the req object. If the args parameter is not null
(that is, when an AJAX form is submitted), then the form data is sent to the server. If args is null ,
then the s upplied URL is sent to the server. The processing of incoming text takes place inside of the
onreadystatechange handler.
If replace is true (meaning that target=???_replace??? is specified in the calling link), then the
replaceElementWithSource() function is called. As the following code shows, the calling link
node (the replace parameter) is replaced with the source (the AJAX document fragment):
function replaceElementWithSource(replace, source)
{
var page = replace.parentNode;
var parent = replace;
while (page.parentNode != document.


Pages:
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101