why my other paramter is null. "date" and "ids" is null while my "postedFile" and "amount" has a data. but when i try to removed "postedFile" parameter. the ids and date has a value. and it works fine. but i need the postedfile parameter
my script
- var ids = [];
- function add(id, isChecked) {
- if (isChecked) {
- ids.push(id);
- }
- else {
- var i = ids.indexOf(id);
- ids.splice(i, 1);
- }
- }
-
- function saveSelected() {
-
- var date = $('#Date').val();
- var amount = $('#Amount').val();
-
-
- $('#imageUploadForm').on("change", function () {
- var formdata = new FormData($('form').get(0));
- CallService(formdata);
- });
-
- function CallService(postedFile) {
- $.ajax({
- url: '@Url.Action("index", "payment")',
- type: 'POST',
- data: { ids: ids, amount: amount, date: date, postedFile: postedFile },
- cache: false,
- processData: false,
- contentType: false,
- traditional: false,
- dataType:"json",
- success: function (data) {
- alert("Success");
- }
- });
- }
- }
My controller
- public ActionResult Index(int?[] ids, decimal? amount, DateTime? date, HttpPostedFileBase postedFile)
- {
- return View();
- }