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 BegPosted May 16, 2020, 8:33 AM
Denmark PusoPosted May 16, 2020, 7:38 AM
Salman BegPosted May 16, 2020, 7:30 AM
Denmark PusoPosted May 16, 2020, 7:26 AM
Salman Beg
Salman BegPosted May 16, 2020, 2:36 AM
Denmark PusoPosted May 16, 2020, 2:06 AM
Salman BegPosted May 14, 2020, 9:15 AM
Denmark PusoPosted May 14, 2020, 9:00 AM
Salman Beg
Salman BegPosted May 14, 2020, 7:32 AM
Denmark PusoPosted May 14, 2020, 7:25 AM
Salman Beg
Salman BegPosted May 14, 2020, 7:07 AM
Denmark PusoPosted May 14, 2020, 6:50 AM
Salman Beg
Salman BegPosted May 14, 2020, 4:07 AM