Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
вопервых вы не ТС.попросилиже готовые примеры, или сложно кусок кода представить?
<?php
//<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
// Load JsHttpRequest backend.
require_once "./JsHttpRequest/JsHttpRequest.php";
$JsHttpRequest =& new JsHttpRequest("windows-1251");
$REQ = array("ERR"=>0, "RES"=>0);
if (@$_REQUEST['q']) {
if ( $_REQUEST['q']=="send_data" ) { $REQ = send_data(@$_REQUEST['v']); }
} else die("JSHttp_error_blackcat");
$_RESULT = array( 'REQ'=>$REQ );
function send_data($data) {
return array( 'ERR'=>0, 'RES' =>"vilikij i ujasny ajax prislal nam PREVED:".$data);
}
?>
<?php
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transit
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>Untitled Document</title>
<script src="./JsHttpRequest/JsHttpRequest-full.js"></script>
<script language="javascript" language="JavaScript">
function doAction(command, value, target) {
var req = new JsHttpRequest();
req.onreadystatechange = function() {
if (req.readyState == 4) {
ERR= req.responseJS['REQ']['ERR'];//get REQUEST/ERROR
REQ= req.responseJS['REQ']['RES'];//get REQUEST/RESULT
// Write result to page element (_RESULT becomes responseJS).
switch(command) {
case "send_data":
str=REQ;
document.getElementById(target).innerHTML = str;
break;
}
}
}
req.open(null, 's_b.php', true);
req.send( { q: command, v:value } );
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<p> </p>
<form method="post" id="f" enctype="multipart/form-data" onsubmit="return false">
Text:
<textarea name="txt" id="txt" cols="50" rows="3"></textarea>
<input type="button" value="Send data" onclick="doAction('send_data',this.form.txt.value,'result');">
</form>
<p> result </p>
<div id="result" style="border:1px solid #000; padding:2px"> Results div </div>
</body>
</html>
<body>
<a href='page.html'>page</a>
<div id='content'></div>
</body>
window.addEvent('domready', function() {
$$('a').each(function(item) { // для всех ссылок на странице (можна и изменить селектор)
item.addEvent('click', function() {
new Request({
url: this.href; // <a href = ...
method: 'GET',
onComplete: function(text) {
$('content').innerHTML = text;
}
}).send();
}.bind(item);
return false; // блокирует переход по ссылке
}
});