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 shipmentId = $('#c-shipment-id').val();
- var date = $('#Date').val();
- var amount = $('#Amount').val();
- //var ImageFile = $('#imageUploadForm').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();
- }

Salman BegRank #284 · 8.8K reputationPosted May 14, 2020, 12:07 AM EDT
Denmark PusoRank #7,130 · 248 reputationPosted May 14, 2020, 2:50 AM EDT
Salman Beg
Salman BegRank #284 · 8.8K reputationPosted May 14, 2020, 3:07 AM EDT
Denmark PusoRank #7,130 · 248 reputationPosted May 14, 2020, 3:25 AM EDT
Salman Beg
Salman BegRank #284 · 8.8K reputationPosted May 14, 2020, 3:32 AM EDT
Denmark PusoRank #7,130 · 248 reputationPosted May 14, 2020, 5:00 AM EDT
Salman Beg
Salman BegRank #284 · 8.8K reputationPosted May 14, 2020, 5:15 AM EDT
Denmark PusoRank #7,130 · 248 reputationPosted May 15, 2020, 10:06 PM EDT
Salman BegRank #284 · 8.8K reputationPosted May 15, 2020, 10:36 PM EDT
Denmark PusoRank #7,130 · 248 reputationPosted May 16, 2020, 3:26 AM EDT
Salman Beg
Salman BegRank #284 · 8.8K reputationPosted May 16, 2020, 3:30 AM EDT
Denmark PusoRank #7,130 · 248 reputationPosted May 16, 2020, 3:38 AM EDT
Salman BegRank #284 · 8.8K reputationPosted May 16, 2020, 4:33 AM EDT