开发者社区> 问答> 正文

jquery ajax 的$.post()跟$.get()方法有什么区别

jquery ajax 的$.post()跟$.get()方法有什么区别,怎么该觉效果都一样,

还有就是,jquery ajax 批量删除

<a href="javascript:del()">批量删除</a>

<form id="dataForm" method="post" action="">
<td width="30px"><input class="checkbox_css" type="checkbox" name="aids[]" value="{$list.id}"></td>
</form>

function del(){
    $.post("{:U('YPadmin/'.$Think.MODULE_NAME.'/del')}",{id:不知道怎么写},complete); 
}

后台php直接$_POST['aids']不能直接获取到前台input name=aids[]的值么,一个数组?

展开
收起
a123456678 2016-07-07 14:20:15 2398 0
1 条回答
写回答
取消 提交回答
  • jQuery.each( [ "get", "post" ], function( i, method ) {
        jQuery[ method ] = function( url, data, callback, type ) {
            // shift arguments if data argument was omitted
            if ( jQuery.isFunction( data ) ) {
                type = type || callback;
                callback = data;
                data = undefined;
            }
    
            return jQuery.ajax({
                type: method,
                url: url,
                data: data,
                success: callback,
                dataType: type
            });
        };
    })
    2019-07-17 19:52:45
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Javascript中的对象 立即下载
Javascript中的函数 立即下载
JavaScript函数 立即下载