ITsolutionWizard
asked on
Ajax call for data and upload
Below ajax code working but now I have to add file upload together.
Is it possible to submit form data such as text box and upload jpg in one ajax call?
Is it possible to submit form data such as text box and upload jpg in one ajax call?
<div class="row">
<div class="col-fs-12">
<input type="file" />
</div>
</div>
$.ajax({
url: ApiName,
datatype: "text",
data:
{
'blogid': blogID,
'blogsubject': blogsubject,
'blogbody': body.replace("'"," "),
'createdby': '@System.Configuration.ConfigurationManager.AppSettings["MemberIDDefaultContentWriterName"]',
'createdon': blogdate,
'stage': blogStage,
'actiontype': blogActionType,
'blogurl': blogFileName,
'memberid': '@System.Configuration.ConfigurationManager.AppSettings["MemberIDDefaultContentWriter"]',
'blogtype': 'Event',
'eventtype': eventType,
'eventid': eventID,
'eventIcon': eventIcon
},
type: "POST",
success: function (data) {
var id = data.BlogID;
alert("Update accordingly");
//window.location.href = entireURL;
},
error: function (error) {
alert("Error " + error);
}
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Do u have Mvc example like how to pick up the file and data using Mvc controller?
ASKER
any helps?
Do u have Mvc example like how to pick up the file and data using Mvc controller?Unfortunately I don't.
I would recommend opening a separate question for that in the .Net topic area.
ASKER