日期:2014-05-17 浏览次数:20988 次
$.ajax({
cache: true,
type: "POST",
url:ajaxCallUrl,
data:$('#yourformid').serialize(),// 你的formid
async: false,
error: function(request) {
alert("Connection error");
},
success: function(data) {
$("#commonLayout_appcreshi").parent().html(data);
}
});
------解决方案--------------------
var options ={
url:'xxxx.action',
type:'post',
data:null,
success:function(data){
if(data.statusCode=="OK") {
}else{
}
}
};
var form =$("form[name=form1]");//form1:表单ID 在表单界面只用这一个表单ID
form.ajaxSubmit(options);
------解决方案--------------------
jQuery ajax - serialize() 方法
定义和用法
serialize() 方法通过序列化表单值,创建 URL 编码文本字符串。
您可以选择一个或多个表单元素(比如 input 及/或 文本框),或者 form 元素本身。
序列化的值可在生成 AJAX 请求时用于 URL 查询字符串中。
<form>
<div><input type="text" name="a" value="1" id="a" /></div>
<div><input type="text" name="b" value="2" id="b" /></div>
<div><input type="hidden" name="c" value="3" id="c" /></div>
<div>
<textarea name="d" rows="8" cols="40">4</textarea>
</div>
<div><select name="e">
<option value="5" selected="selected">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select></div>
<div>
<input type="checkbox" name="f" value="8" id="f" />
</div>
<div>
<input type="submit" name="g" value="Submit" id="g" />
</div>
</form>
$('form').submit(function() {
alert($(this).serialize());
return false;
});
------解决方案--------------------
$.ajax({
url: "/OrderManage/DataSave",
data: {
strMALL_CD: function () { return strMALL_CD; }, //モール
strSHOP_CD: function () { return strSHOP_CD; }, //店舗
strORDER_CD: function () { return strORDER_CD; }, //注文書
strBILL_RETURN_CD: function () { return strBILL_RETURN_CD; }, //返品書
strEMPLOYER_NM: function () { return strEMPLOYER_NM; }, //発注者
strEMPLOYER_TEL: function () { return strEMPLOYER_TEL; }, //電話番号
strEMPLOYER_TEL1: function () { return strEMPLOYER_TEL1; }, //携帯番号
strEMPLOYER_MAIL: function () { return strEMPLOYER_MAIL; }, //メール
strCONSIGNEE_NM: function () { return strCONSIGNEE_