How to upload Iform File in iframe was binding null javascript jquery

0 votes

In asp.net core , i define ProductUpdateRequest has  public IFormFile ThumbnailImage { get; set; } . I create update form in iframe. when I submit form with

jQuery(function ($) {
    $("#btnsubmit").click(function (e) {
        
        //Serialize the form datas.   
        var valdata = $("#updateProductForm").serialize();
        
        //to get alert popup   
        $.ajax({
            url: "/Products/Update",
            data: valdata,
            dataType: "json",
            type: "POST",
            success: function (response) {
                alert(1);
            }
        });
    });   
    
});

asp.net have bind data from the form to request model :

[HttpPost]
        public async Task<IActionResult> Update([FromForm] ProductUpdateRequest request)

but request.ThumbnailImage is null. How can I post img (Iform File) to the server by ajax from iframe? When update action is done, what would I do if I want to get a response to

success: function (response) {
                alert(1);
            }

and told to parent page to reload to update new data? Help me, I can't understand this problem...

Aug 19 in Web Development by gaurav
• 18,960 points
40 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Web Development

0 votes
0 answers

How to filter JSON Data in JavaScript or jQuery?

How to filter JSON data using Javascript ...READ MORE

Jul 1 in Web Development by rajatha
• 7,440 points
224 views
0 votes
1 answer

How to download a file by jQuery.Ajax?

Hello @kartik, You don't need to do this ...READ MORE

answered Sep 18, 2020 in Web Development by Niroj
• 82,780 points
5,728 views
0 votes
1 answer

how to use substr() function in jquery?

To get substring of a string in ...READ MORE

answered Jun 27 in Web Development by rajatha
• 7,440 points
39 views
0 votes
1 answer

How to loop through array in jQuery?

Generic loop: var i; for (i = 0; i ...READ MORE

answered Jun 28 in Web Development by rajatha
• 7,440 points
43 views
0 votes
1 answer

How to display current element in jQuery?

<! DOCTYPE html> <html> <head> <script> $(document). ready(function(){ $("button"). click(function(){ $("p"). text("Welcome to ...READ MORE

answered Jun 27 in Web Development by rajatha
• 7,440 points
70 views
0 votes
1 answer

How to create a simple map using JavaScript/JQuery

var map = new Object(); // or ...READ MORE

answered Jun 27 in Web Development by rajatha
• 7,440 points
49 views
0 votes
1 answer

Ajax using JQuery in ASP .NET c#

jQuery Ajax in ASP.Net $.ajax({      & ...READ MORE

answered Jun 15 in JQuery by rajatha
• 7,440 points
235 views
0 votes
0 answers

UL subdrop not working with jquery in Asp.Net C#

Keep searching why sub drop not working ...READ MORE

Jul 29 in Web Development by gaurav
• 18,960 points
20 views
0 votes
1 answer

Authenticate on an ASP.Net Forms Authorization website from a console app

Essentially, we need to record a regular ...READ MORE

answered Sep 20, 2018 in IoT (Internet of Things) by Annie97
• 2,160 points
284 views
0 votes
1 answer

Embedding Power Bi Report Promise is not defined powerbi.js

IE does not yet support Promise. You ...READ MORE

answered Oct 30, 2018 in Power BI by Shubham
• 13,490 points
1,232 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP