javascript - Looking for an example of using ajax to request the display of complete points after getting the background interface.
淡淡烟草味
淡淡烟草味 2017-05-19 10:29:04
0
2
367

Looking for an example of displaying data through jquery ajax request after getting the background interface. It is best to be complete and easy to understand. Thank you

淡淡烟草味
淡淡烟草味

reply all(2)
给我你的怀抱
<script type="text/javascript">
    var url = "http://www.test.com/demo/test";
    $.ajax({
        type: "post",
        url: url,
        data: {
            "title": "dads", "name": "xxx", "sex": "1"
        },
        dataType: "json",
        success: function (data) {
            if ("true" == data.status) {
                alert("成功!");

                //这里也可以循环data里你要显示的数据

                return true;
            } else {
                alert("失败!错误信息如下:" + data.errorMsg);
                return false;
            }
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            alert("请求失败!");
        }
    });

</script>
phpcn_u1582
$.post("api",{传递参数},function(data){
    console.log(data);
    //data就是返回来的数据
})
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template