js代码求解释解决思路
js代码求解释
以前 js代码一点也没接触过 早上一个朋友给我的代码 我不好意思 打扰他了 球解释
()(jQuery);
function($)
$.fn.ajaxSubmitForm
------解决方案--------------------
$.fn.ajaxSubmitForm
就是jQuery.fn.ajaxSubmitForm ,应该是用ajax提交表单的意思。
()(jQuery);
function($)
这两边要放一起看。
(function($) {
})(jQuery);
即执行一个匿名方法function(param) 参数是jQuery。
更多内容,楼主google查下jQuery吧。
以前 js代码一点也没接触过 早上一个朋友给我的代码 我不好意思 打扰他了 球解释
()(jQuery);
function($)
$.fn.ajaxSubmitForm
- JScript code
(function($) { $.fn.ajaxSubmitForm = function(options) { var thisElement = $(this); //当每次点击查询按钮时,查询的数据显示第一页 thisElement.find(":submit").bind("click",function(){ $("#queryPage").val("1"); }); var defaults = { target : '#responseoutput', type : 'post',//数据提交方式 dataType : 'html',//ajax返回数据格式 beforeSubmit : function(formData, jqForm, options){ return true; }, success : function(responseText, statusText, xhr, $form){ $("#" + options.showPagerId).html(""); $("#" + options.showPagerId).append(responseText); }, resetForm : false, timeout : 10000, error:function(tip){ alert("出错了:" + tip.status); }, showPagerId:'showPager' }; var options = $.extend(defaults, options); this.each( function() { var output = document.getElementById("responseoutput"); if (output == null) { var putdiv = document.createElement("div"); putdiv.id = "responseoutput"; putdiv.style.display = "none"; document.body.appendChild(putdiv); } $(thisElement).ajaxForm(options); $(thisElement).trigger("submit"); }); }; })(jQuery);
------解决方案--------------------
$.fn.ajaxSubmitForm
就是jQuery.fn.ajaxSubmitForm ,应该是用ajax提交表单的意思。
()(jQuery);
function($)
这两边要放一起看。
(function($) {
})(jQuery);
即执行一个匿名方法function(param) 参数是jQuery。
更多内容,楼主google查下jQuery吧。