ie8 ajax提交表单,IE8下 ajaxSubmit兼容问题

ie8下 ajaxSubmit 提交成功后返回的json数据,拿到的是当前界面的html代码

前端form:

导入文件:

导入

导入结果:

后端:

public void ProcessRequest(HttpContext context)

{

HttpResponse response = context.Response;

response.Clear();

response.ContentType = "text/plain";

//response.ContentType = "application/json";

//response.Write("Hello World");

response.Charset = "utf-8";

response.ContentEncoding = System.Text.Encoding.UTF8;

response.AddHeader("Access-Control-Allow-Origin", "*");

response.AddHeader("Access-Control-Allow-Methods", "POST");

response.AddHeader("Access-Control-Allow-Headers", "x-requested-with,content-type");

string type = string.IsNullOrEmpty(context.Request["type"]) ? "" : context.Request["type"];

Result result = new Result();

FrockCarInterface inf = new FrockCarInterface();

switch (type)

{

case "importmodel"://导入接口

string UserID = string.IsNullOrEmpty(context.Request["emp_id"]) ? "" : context.Request["emp_id"];//获取当前登录用id

string names = Base.GetUserNameS(UserID);

string FileNames = string.IsNullOrEmpty(context.Request["FileNames"]) ? "" : context.Request["FileNames"];

string merge = string.IsNullOrEmpty(context.Request["merge"]) ? "" : context.Request["merge"]; ;

int rows = string.IsNullOrEmpty(context.Request["rows"]) ? 0 : Int32.Parse(context.Request["rows"]);

int tempType = string.IsNullOrEmpty(context.Request["tempType"]) ? 0 : Int32.Parse(context.Request["tempType"]);

result = inf.Import(FileNames, merge, rows, tempType, UserID, names);

break;

};

string json = JsonHelper.Json(result);

response.Write(json);

response.End();

}

导入JS:

//导入excel

$('#importGZC').click(function() {

$("#formGZC").ajaxSubmit({

type: 'post',

url: urlImport,

// dataType: 'text/html',

success: function(dsadfsad) {

alert(dsadfsad)

/* if (d) {

$('#win').dialog('close');

$.messager.alert('提示', "导入成功");

$.get(urlReturn, function(data) {

$('#GZCDetailedTab').datagrid('loadData', data.data);

});

} else {

$.messager.alert('警告', messagers.errMsg);

} */

},

error: function(d) {

$.messager.alert('错误', "导入错误");

}

})

});

页面头文件:

e7f22ae3afb9f6396095c40fce65050f.png

IE8

059dd036d44bbc36af30909c4d6e7f13.png

GOOGLE

d4f47c662f449d6b8a7f3a72ce0e29cb.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值