I am developing MVC 5 App. I have a Parent View that call a Partial View, where user can Load a Image.
On Submit a call a .Ajax defined in Parent view that call Method/Controller.
What I need is to send to the controller data I have in Parent View. Is that Posible?
Here is my code.
Parent View
Partial View
.Ajax Method
$('#formPhoto').submit(function (event) {
event.preventDefault();
if ($(this).valid()) {
var id="aaa";
var formdata = new FormData($(this).get(0));
$.ajax({
url: this.action,
type: this.method,
data:formdata,
processData: false,
contentType: false,
beforeSend: function () {
return true;
},
success: function (result) {
successPhoto();
},
complete: function () {
// alert(3);
// And so on.
}
});
}
return false;
});
I need to send var aa='aaa' in data:


Yes it's possible. So basically I can suggest for you two ways to do what you need:
1st: You could consider putting the form element in the ParentView and change your code a little bit... 2nd: You could recover the data from the parent view and serialize it together to send to your action.
So, from the second option it would be something like:
Please, I hope this solve your problem