/*
$.ajax({
            url: "Blog/Test/" + Math.random(), //要访问的后台地址
            data: "", //要发送的数据
            type: 'GET', // 设置请求类型为 ‘POST’,默认为 ‘GET’
            beforeSend: function() {
                $('#load').show();
            },
            error: function(request) {
                $('load').hide();
                $('#error').show().html(request.responseText);
            },
            success: function(data) {
    $("#password").text(data.Password);
            }
        });
  */

        //$.getJSON("/Blog/Test/"+Math.random(), {}, function(data) { $("#password").html(data.Password) });
        $.ajax({
            type: "get", //使用get方法访问后台
            dataType: "json", //返回json格式的数据
            url: "http://localhost:6923/blog/Test/" + Math.random(), //要访问的后台地址
            data: "", //要发送的数据
            complete: function() { $("#load").hide(); }, //AJAX请求完成时隐藏loading提示
            success: function(data) {//msg为返回的数据,在这里做数据绑定
                $("#password").text(data.Password);
            }
        }
                );

相关文章:

猜你喜欢
  • 2021-11-30
  • 2021-05-16
  • 2021-07-05
  • 2022-02-08
  • 2021-10-03
相关资源
相似解决方案