*?logo*????2012fingerknow.com|?||ICP12003619-1/****V1.0*/$(document).ready(function(){//??$("#businessName").blur(function(){varbusinessName=$("" /> 

新手帮助当前位置:风暴娱乐 > 新手帮助 > >

jquery的ajaxSubmit()异步上传图片并保存表单数据演

  

  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
??
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  

© 2012 fingerknow.com |?||ICP12003619-1

  
  
  
  
  
  
  
/**  
*  
* V1.0  
*/  
$(document).ready(function() {  
  
//??

  
$("#businessName").blur(function(){  
var businessName=$("#businessName").val();  
if(businessName!=""){  
$("#businessName_error").html("");  
}else{  
$("#businessName_error").attr("class","error_div").html(""+"???");  
}  
  
});  
//???

  
$("#businessEname").blur(function(){  
var businessEname=$("#businessEname").val();  
if(businessEname!=""){  
$("#businessEname_error").html("");  
}else{  
$("#businessEname_error").attr("class","error_div").html(""+"????");  
}  
});  
//??? ?

  
$("#imgSave").click(function(){  
var ext='.jpg.jpeg.gif.bmp.png.';  
var f=$("#file").val();  
if (f=="") {//ж???

  
$("#file_error").attr("class","error_div").html(""+"?logo");  
return false;  
}  
f=f.substr(f.lastIndexOf('.') + 1).toLowerCase();  
if (ext.indexOf('.' + f + '.')==-1) {  
$("#file_error").attr("class","error_div").html(""+"????");  
return false;  
}  
  
var options={  
url: "${ctx}/upload/upload.do",  
dataType: 'json',  
contentType: "application/json; charset=utf-8",  
success: function(data) {  
// 'data' is an object representing the the evaluated json data  
// ????????

  
if(data.status=="0"){  
var fileName=data.fileName;  
//alert(fileName);  
var businessName=$("#businessName").val();  
var userId=$("#userId").val();  
var businessEname=$("#businessEname").val();  
businessName=encodeURI(businessName);  
businessName=encodeURI(businessName);  
var urls="${ctx}/business/addBusiness.do?businessName="+businessName+"&businessPic="+fileName+"&businessEname="+businessEname+"&userId="+userId;  
$.ajax({  
type: "post",   (责任编辑:admin)

上一篇:Mootools 1.2教程 定时器和哈希简介

下一篇:没有了

推荐内容

客户服务热线

010-400-12345

在线客服