• jquery .ajax


    view:

        $(document).ready(function() {
            var ss="asdff";
            $(".check").click(function(){
                alert("OK");    
                $.ajax({
                type:'get',
                url:'<?php echo URL::base(true)?>purchasepay/finance/purchasepay/payaction',
                async:false,
                data:{pro:ss,needpay:ss},
                success:function(data)
                {
                    alert(data);
                },
                error:function(){
                    alert("error");
                }
            });
                });
        });
    
        

    controller:

            $s=$_GET["pro"];
            
            echo json_encode ( $s );      

    $.each()

      $.each(data, function(commentIndex, comment){
                                   html += '<div class="comment"><h6>' + comment['username']
                                             + ':</h6><p class="para"' + comment['content']
                                             + '</p></div>';
                             });

    $.each()函数不同于JQuery对象的each()方法,它是一个全局函数,不操作JQuery对象,而是以一个数组或者对象作为第1个参数,以一个回调函数作为第2个参数。回调函数拥有两个参数:第1个为对象的成员或数组的索引,第2个为对应变量或内容。

  • 相关阅读:
    Android笔记:数据储存
    Android笔记:管理所有活动
    Android随笔:属性
    Android笔记:限定符
    Android笔记:ninepatch
    Android笔记:获取屏幕信息
    js自动完成
    动态生成实体类
    EF框架学习手记
    js遮罩效果
  • 原文地址:https://www.cnblogs.com/canbefree/p/3709846.html
Copyright © 2020-2023  润新知