0

I am working on asp classic. I have three fields
First Name
Last Name
Upload Image
I want to post data with ajax request to .asp page and want to retrieve values on .asp page. I have post request like this:

 jQuery.ajax({
                    type:"POST",
                    data:
                    {
                        'method':'EOTMInsert',
                        'fname':Fname,
                        'lname':Lname
                    },
                    url:"/async2.asp",
                    dataType:"text",
                    success:function(data, status) {
                        httpResults = data;
                        alert("Employee saved.");
                        jQuery(location).attr('href','/eotm.asp');
                    },
                    async:false
                });

Values retrieved on .asp form

set fname = Request("fname")
        set lname = Request("lname")

Now, I also want to post image and want to save on root path.

If have any idea please share with me. Thanks

Dinesh undefined
  • 5,490
  • 2
  • 19
  • 40
Gurpreet Singh
  • 165
  • 4
  • 18
  • what you have tried so for? with out your code how can we help? – Dinesh undefined May 31 '17 at 05:12
  • I have edited the request, please go through the detail once. – Gurpreet Singh May 31 '17 at 05:34
  • 2
    duplicate https://stackoverflow.com/questions/19447435/ajax-upload-image – Dinesh undefined May 31 '17 at 05:37
  • @Dinesh this answer is related to `php` language, not `asp` – Ricardo Pontual May 31 '17 at 11:13
  • @RicardoPontual he wants to upload file using ajax with some input thats why i gave that link. he has problem client side not server side – Dinesh undefined May 31 '17 at 11:15
  • @Dinesh I understand and it's a good link, but since it's not same problem, due to the platform difference, you can suggest the link, but not say it's duplicate – Ricardo Pontual May 31 '17 at 11:20
  • 1
    Thanks @Dinesh and @Ricardo, i have fixed this problem using below code and used `clsUpload` class for image and retrieve field values at server side. `$('#customerFirstForm').bind('submit',(function(e) { e.preventDefault(); var formData = new FormData(this); $.ajax({ type:'POST', url: $(this).attr('action'), data:formData, cache:false, contentType: false, processData: false, success:function(data){ console.log("Success"); }, error: function(data){ console.log("error"); } }); }));` – Gurpreet Singh May 31 '17 at 11:39
  • @GurpreetSingh congrats. you found your answer – Dinesh undefined May 31 '17 at 11:41

0 Answers0