2016年3月30日 星期三
Jquery Learning 1.Get All inputs. 2.Find all(same) ids, 3. ajax send all inputs
var $inputs = $('#formIndex :input');
var formCollection = $(':input');
$inputs.each(function (index) {
var values = $("input[id="+$(this).attr('id')+"]").map(function () { return $(this).val(); }).get();
if (values.length > 0 && values[0] == values[3])
{
alert('顯示順序與EDM順序相同請調整');
isSubmit = false;
return false;
}
//console.log(values);
//ids[$(this).attr('name')] = $(this).attr('id');
});
$.ajax({
type: "POST",
url: "<%= Url.Action("Save") %>",
cache: false,
data: inputs, //formCollection,
success: function(formIndex) {
if (formIndex == "Success"){
alert("儲存成功!!");
window.location.reload();
//$("#formIndex").submit();
}
else{
alert("儲存失敗!!");
$("#ErrMsg").html(formIndex);
}
}
});
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言