zoukankan      html  css  js  c++  java
  • jquery提供的数据提交方式1

    1,ajax提交,部分代码为easyui

    function editNode(id){
        $.ajax({
            dataType:'json',
            async:true,        //默认的就是异步提交
            type:'post',
            url:"__APP__/控制器/方法",
            data:{id:id},
            success:function(data){
                row = eval('('+data+')');        //计算某个字符串,并执行其中的的 JavaScript 代码
                if (row){
                    $('#dlg-form').form('clear');
                    $('#dlg').dialog('open').dialog('setTitle','编辑');
                    $('#dlg-form').form('load',row); 
                    
                    $("[name^=tuitype]").each(function(){
                        var val=$(this).val();
                        if(row.tuitype.indexOf(val)>-1){                         
                        $(this).attr("checked",true);
                        }
                    });
                }else{
                    $.messager.show({
                        title: '出错啦!!',
                        msg: '请选择一条'
                    });
                }
            }
        });
    }

     2,ajax的load传递方法

    load(url, [data][callback])

    url:待装入 HTML 网页网址。

    data:发送至服务器的 key/value 数据。在jQuery 1.3中也可以接受一个字符串了。

    callback:载入成功时回调函数。

    $("#btnAjaxCallBack").click(function()
    {
        //发送Post请求, 返回后执行回调函数.
        $("#divResult").load("./AjaxGetMethod.php",{"param": "btnAjaxCallBack_click"}, function(responseText)
        {
            responseText = " Add in the CallBack Function! <br/>" + responseText;
            $("#divResult").html(responseText); //或者: $(this).html(responseText);
        });
    });
  • 相关阅读:
    word查找与替换
    细说ASP.NET Windows身份认证
    防钓鱼代码
    sql触发器
    url地址栏参数
    sql递归查询
    认识TWICImage类
    尝试发个贴
    泛型单元
    [学习官方例子]TArray
  • 原文地址:https://www.cnblogs.com/zhangyabin---acm/p/4469643.html
Copyright © 2011-2022 走看看