自己写的AjaxForm
$.extend({
AjaxForm: function (action, formID, callback) {
var form = $("#" + formID);
form.attr("action", action);
form.attr("method", "post");
$("#callbackmethod").remove();
form.append("<input id='callbackmethod' name='callbackmethod' type='hidden' value='" + callback + "' \>");
var ajaxiframe = formID + "_AjaxIFrame";
form.attr("target", ajaxiframe);
form.append("<iframe name='" + ajaxiframe + "' id='" + ajaxiframe + "' style='display:none;'></iframe>");
form.attr("enctype", "multipart/form-data");
form.submit();
},
ToJson: function (str) {
return eval('(' + str + ')');
}
});
AjaxForm: function (action, formID, callback) {
var form = $("#" + formID);
form.attr("action", action);
form.attr("method", "post");
$("#callbackmethod").remove();
form.append("<input id='callbackmethod' name='callbackmethod' type='hidden' value='" + callback + "' \>");
var ajaxiframe = formID + "_AjaxIFrame";
form.attr("target", ajaxiframe);
form.append("<iframe name='" + ajaxiframe + "' id='" + ajaxiframe + "' style='display:none;'></iframe>");
form.attr("enctype", "multipart/form-data");
form.submit();
},
ToJson: function (str) {
return eval('(' + str + ')');
}
});
$.AjaxForm('<%=Url.Content("~/Utility/PicUploadHander.ashx")%>', 'UpLoadForm', function (str) {
var json = eval('(' + str + ')');
alert(json.Name);
parent.Home();//主页面的方法
});
private void WriteForm(string str, HttpContext context)
{
string method = context.Request["callbackmethod"];
string isJson = context.Request["isJson"];
string hs = "<script> void " + method + " ('" + str + "');</script>";
context.Response.Write(hs);
context.Response.Flush();
context.Response.Close();
}
少侠,我看你气度不凡天赋异禀,骨骼精奇,这么帅,来了就帮推荐一把吧
我的最近更新