JQuery学习记录

来源:互联网 发布:中国东盟贸易数据 编辑:程序博客网 时间:2024/06/05 09:33

1、each循环方法,将集合中的数据逐行遍历出来。

    <script type="text/javascript" language="javascript">        $(function () {            var data = [{ "id": 1, "text": "My Documents" }, { "id": 2, "text": "friends"}];            //each的用法            $.each(data, function (i, item) {                alert(i + "==>" + item.id + "==>" + item.text);            });        });    </script>
2、ajax方法使用实例

$.ajax({    url: '../Handler/WF/FlowWork.ashx?flag=Fn_Flowsubmit&rand=' + Math.random(),    type: "POST",    dataType: "text",//可以为Json    data: { P_Instance: P_Instance },    success: function (result) {        if (parseInt(result) > 0) {            window.parent.frameReturnByClose();            window.parent.frameReturnByReload();            window.parent.frameReturnByMes("提交成功");        }        else {            window.parent.frameReturnByMes("提交失败1");        }    },    error: function (XMLHttpRequest, textStatus, errorThrown) {        window.parent.frameReturnByMes("提交失败2");        return;    }});



0 0
原创粉丝点击