<button dojoType = ”Button” widgetId = ”helloButton”>
<script type = "dojo / method" event = "onClick">
dojo.xhrGet ({
url: 'response.txt',
load: helloCallback,
error: helloError
});
</ script>
</ button>
<button dojoType = ”dijit.form.Button” id = ”helloButton”>
Hello World!
<script type = "dojo / method" event = "onClick">
dojo.xhrGet ({
url: 'HelloWorldResponseGET.php',
load: helloCallback,
error: helloError,
content: {name: dojo.byId ('name'). value}
});
</ script>
</ button>
Enter your name: <input type = ”text” id = ”name”>
content: {myName: dojo.byId ('name'). value}
<? php
/ *
* HelloWorldResponseGET.php
* /
header ('Content-type: text / plain');
print “Hi, {$ _GET ['name']}! \ n”;
?>
<%
'
'HelloWorldResponseGET.asp
'
response.ContentType = ”text / plain”
response.write (”Hi,” & request.querystring (”name”) & “! \ n”)
%>
#! / usr / bin / perl
#
# 'HelloWorldResponseGET.pl
use strict;
use CGI;
my $ cgi = CGI :: new ();
print $ cgi-> header (-type => “text / html; charset = utf-8?);
print “Hi,”. $ cgi-> param ('name'). “! \ N”;
<br>
Please enter your name: <input type = "text" id = "name">
<br>
<form id = "myForm" method = "POST">
Please enter your name: <input type = "text" name = "name">
</ form>
<script type = "dojo / method" event = "onClick">
dojo.xhrGet ({
url: 'HelloWorldResponseGET.php',
load: helloCallback,
error: helloError,
content: {name: dojo.byId ('name'). value}
});
</ script>
<script type = "dojo / method" event = "onClick">
// Remember to change the URL!
dojo.xhrPost ({
url: 'HelloWorldResponsePOST.php',
load: helloCallback,
error: helloError,
form: 'myForm'
});
</ script>
<? php
/ *
* HelloWorldResponsePOST.php
* /
header ('Content-type: text / plain');
print “Hi, {$ _POST ['name']}! \ n”;
?>
<%
'
'HelloWorldResponsePOST.asp
'
response.ContentType = "text / plain"
response.write ("Hello," & request.form ("name") & "! \ n")
%>
Hello, # form.name #, welcome to the world of Dojo!
<%
/ *
'HelloWorldResponsePOST.jsp
* /
response.setContentType ("text / plain");
%>
Hi, <% = request.getParameter ("name")%>!
#! / usr / bin / perl
#
# 'HelloWorldResponsePOST.pl
#
use strict;
use CGI;
my $ cgi = CGI :: new ();
print $ cgi-> header (-type => "text / html; charset = utf-8");
print "Hello,". $ cgi-> param ('name'). "! \ n";
Source: https://habr.com/ru/post/37380/
All Articles