Новости | FAQ | Авторы | Документация | В действии | Библиотека |
Инструменты | Полезные ссылки | Хостинги | Скачать | Примеры | Форум |
Mizter Egoist 13.12.2016 14:56
Добрый день!@main[] <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>sens</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> <script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.js"></script> <script type="text/javascript" src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <script type="text/javascript" src="/bulk/js/JsHttpRequest.js"></script> </head> <body> <div id="content"> ^js[/0/load.html] <form name="sendForm" id="sendForm" method="POST" enctype="multipart/form-data" accept-charset="UTF-8" onsubmit="return false"> <input type="text" name="name" placeholder="Имя"> <input type="text" name="email" placeholder="Электронная почта"> <input type="text" name="login" placeholder="Логин"> <input type="text" name="pass" placeholder="Пароль"> <input type="file" name="file"> <input type="button" name="send" value="Отправить" onclick="doLoad('form', 'post', this.form)"> </form> <div id="result" style="border:1px solid #000; padding: 5px; margin: 10px 0px;"> Structured results </div><br> <div id="debug" style="border:1px dashed red; padding: 5px; margin: 10px 0px;"> Debug info </div> </div> </body> </html> @js[sLoaderUri] <script type="text/javascript" language="JavaScript"> function doLoad(loader, method, data) { var req = new JsHttpRequest(); req.onreadystatechange = function() { if (req.readyState == 4 && req.responseJS) { document.getElementById('result').innerHTML = req.responseJS; document.getElementById('debug').innerHTML = req.responseText; } } req.caching = false; req.loader = loader; req.open(method, '$sLoaderUri', true); req.send(data); } </script>Ниже содержимое файла load.html
@USE /bulk/genus/JSHttpRequest.p @main[] ^JSHttpRequest:init[ $.bAllowUnicodeChars(1) # $.bOldStyle(1) # $.sJsClassName[Subsys_JsHttpRequest_Js] ] $hRequest[^JSHttpRequest:decodeRequest[]] $sDebugMessage[ <pre> <b>QUERY_STRING:</b> $request:query <b>Request method:</b> $env:REQUEST_METHOD <b>Content-Type:</b> $env:CONTENT_TYPE <b>Loader used:</b> ^JSHttpRequest:getLoader[] ^printFormContent[$hRequest] </pre> ] ^JSHttpRequest:printResponse[$sDebugMessage; ^json:string[$hRequest] ] ^printDebugInfo[$hRequest] @printDebugInfo[hRequest][sFields;sKey;sValue;dtNow;sDebugInfo] $sFields[^hRequest.foreach[sKey;sValue]{$sKey=$sValue}[&]] $dtNow[^date::now[]] $sDebugInfo[^dtNow.sql-string[] $env:REQUEST_METHOD $request:query $request:body ^JSHttpRequest:getId[] $sFields message: $iMessageId^#0A] ^sDebugInfo.save[append;JSHttpRequest.log] @printFormContent[hRequestData] ^hRequestData.foreach[field;value]{ ${field}: ^if($value is "file"){[file] name: $value.name, size: $value.size ^rem{, content-type: $value.content-type}}{$value} }[<br>]