TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Denmark Puso
NA
232
50.2k
ajax other parameter is null?
May 14 2020 2:44 AM
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();
}
Reply
Answers (
13
)
Push Element to Data Dictionary from JavaScript
File upload selection disappear when form validation kicksin