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?
<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);
}
});
Select all Open in new window