Javascript 将jquery中的snipset代码转换为dojo-ajax
我需要将jquery中的代码更改为dojo。目标只是一个狙击手 jquery代码工作正常,但dojo代码没有 JQUERYJavascript 将jquery中的snipset代码转换为dojo-ajax,javascript,jquery,ajax,dojo,Javascript,Jquery,Ajax,Dojo,我需要将jquery中的代码更改为dojo。目标只是一个狙击手 jquery代码工作正常,但dojo代码没有 JQUERY <script type="text/javascript"> $(document).ready(function() { $(".box").change(function() { $.ajax({ dataType: 'json', type:
<script type="text/javascript">
$(document).ready(function() {
$(".box").change(function() {
$.ajax({
dataType: 'json',
type: "POST",
data: "data=" + $(this).val(),
url: "file.php",
success: function(json) {
$msg = [];
for (var i = 1; i < 10; i++) {
$msg.push(parseFloat(json[i]["valor" + i]));
}
}
});
});
});
</script>
$(文档).ready(函数(){
$(“.box”).change(函数(){
$.ajax({
数据类型:“json”,
类型:“POST”,
数据:“data=“+$(this).val(),
url:“file.php”,
成功:函数(json){
$msg=[];
对于(变量i=1;i<10;i++){
$msg.push(parseFloat(json[i][“valor”+i]);
}
}
});
});
});
道场
查询(“.box”).onchange(函数(){
dojo.xhrGet({
url:“file.php”,
handleAs:“json”,
数据:“data=“+$(this).val(),
加载:函数(json){
$msg=[];
对于(变量i=1;i<10;i++){
$msg.push(parseFloat(json[i][“valor”+i]);
}
}
});
});
已解决
<script type="text/javascript">
dojo.query(".box").onchange(function() {
dojo.xhrPost({
url:"drop2.php",
handleAs:"json",
postData: "data=" + $(this).val(),
preventCache: true,
load: function(json){
$msg = [];
for (var i = 1; i < 10; i++) {
$msg.push(parseFloat(json[i]["valor" + i]));
}
}
});
});
</script>
查询(“.box”).onchange(函数(){
dojo.xhrPost({
url:“drop2.php”,
handleAs:“json”,
postData:“data=“+$(this).val(),
对,,
加载:函数(json){
$msg=[];
对于(变量i=1;i<10;i++){
$msg.push(parseFloat(json[i][“valor”+i]);
}
}
});
});
已解决
<script type="text/javascript">
dojo.query(".box").onchange(function() {
dojo.xhrPost({
url:"drop2.php",
handleAs:"json",
postData: "data=" + $(this).val(),
preventCache: true,
load: function(json){
$msg = [];
for (var i = 1; i < 10; i++) {
$msg.push(parseFloat(json[i]["valor" + i]));
}
}
});
});
</script>
查询(“.box”).onchange(函数(){
dojo.xhrPost({
url:“drop2.php”,
handleAs:“json”,
postData:“data=“+$(this).val(),
对,,
加载:函数(json){
$msg=[];
对于(变量i=1;i<10;i++){
$msg.push(parseFloat(json[i][“valor”+i]);
}
}
});
});