JavaScript How to get canvas edited image data to HTML input field?

<canvas id="c" name="c"></canvas>
<input style="display:none;" type="file" name="nextImage" id="nextImage"/>

Above code is canvas where edited image is placed, below is input field where i want the canvas image value.

jQuery('document').ready(function(){

  jQuery('#svconvac').click(function(e){
      e.preventDefault();
      console.log("Click");
      var canvas = document.getElementById('c');
      var dataURL = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
    //jQuery("#nextImage").val(dataURL);

    console.log(dataURL);
    //return false;
    jQuery.ajax({
      type: "POST",
      url: "editMap.php",
      data: { 
        imgBase64: dataURL
      },
      success: function(data) {
        data['dataURL'] = document.getElementById("nextImage").value;
        console.log('saved'); 
      } 
    });


  });

});

So far what i tried using this ajax function but no chances to be successful, am i calling wrong data in ajax? where it says:

editedMap = $data['dataURL']; 

My Function for saving to database Please also look at this:

public function mapUpdate($data, $file, $id)
        {
            $floor_name =$this->fm->validation($data['floor_name']);

            $floor_name =mysqli_real_escape_string($this->db->link, $data['floor_name']);

            $permited  = array('jpg', 'jpeg', 'png', 'gif');
            $file_name = $file['nextImage']['name'];
            $file_size = $file['nextImage']['size'];
            $file_temp = $file['nextImage']['tmp_name'];

            $div = explode('.', $file_name);
            $file_ext = strtolower(end($div));
            $unique_image = substr(md5(time()), 0, 10).'.'.$file_ext;
            $uploaded_image = "uploads/maps/".$unique_image;

            if($floor_name == '')
            {
                $msg = "<span class='error'> Fields must not be empty !! </span>";
                return $msg;
            }
            else{
                if (!empty($file_name)) 
                {

                    if ($file_size >1048567) 
                    {
                        echo "<span class='error'>Image Size should be less then 1MB! </span>";
                    } 

                    elseif (in_array($file_ext, $permited) === false) 
                    {
                        echo "<span class='error'>You can upload only:-".implode(', ', $permited)."</span>";
                    }


                    else
                    {
                        $delImageQuery = "SELECT * FROM tbl_map WHERE mapId='$id'";
                        $getData = $this->db->select($delImageQuery);

                        if ($getData) 
                        {
                            while ($delImg =$getData->fetch_assoc()) 
                            {
                                $delLink =  $delImg['mapImg'];
                                unlink($delLink);
                            }
                        }


                        move_uploaded_file($file_temp, $uploaded_image);

                        $query= "UPDATE tbl_map SET floorName = '$floor_name', mapImg = '$uploaded_image' WHERE mapId ='$id' ";

                        $update_row =$this->db->update($query);
                        if($update_row)
                        {
                            $msg ="<span class='success'> Map Update successfully. </span>";
                            return $msg;
                        }

                        else 
                        {
                            echo "<span class='error'>Map Not Update !</span>";
                        }
                    }

                } 

                else
                {                               
                    $query= "UPDATE tbl_map SET floorName = '$floor_name' WHERE mapId ='$id' ";

                    $update_row =$this->db->update($query);

                    if($update_row)
                    {
                        $msg ="<span class='success'> Map Update successfully. </span>";
                        return $msg;
                    }

                    else 
                    {
                        echo "<span class='error'>Map Not Update !</span>";
                    }
                }
            }
   }// Update function ends here

Hoping for some help.

Answer:1

function findLongestWordLength(str) { var res = str.split(" "); var ar = []; for (let i = 0; i < res.length; i++) { let leength = res[i].length; ar.push(leength); //ar ...

function findLongestWordLength(str) { var res = str.split(" "); var ar = []; for (let i = 0; i < res.length; i++) { let leength = res[i].length; ar.push(leength); //ar ...

  1. find length of the largest region in boolean matrix
  2. find the length of largest subarray with 0 sum
  3. find the length of largest pole
  4. find the length of longest palindrome in a string

I am using ASP.NET MVC 3, I want to upload a image file using an ajax form My Index view code is: <% using (Ajax.BeginForm("Save","Home", new AjaxOptions() { HttpMethod = "POST", InsertionMode = ...

I am using ASP.NET MVC 3, I want to upload a image file using an ajax form My Index view code is: <% using (Ajax.BeginForm("Save","Home", new AjaxOptions() { HttpMethod = "POST", InsertionMode = ...

I am facing a problem in Google map marker clustering. I am using api v3, but due to some reasons, which I am not able to figure out, I cannot apply marker clustering. I'd be thankful for any help and ...

I am facing a problem in Google map marker clustering. I am using api v3, but due to some reasons, which I am not able to figure out, I cannot apply marker clustering. I'd be thankful for any help and ...

  1. google marker clusterer plus
  2. google marker cluster options
  3. google marker cluster images
  4. google marker cluster color
  5. google marker cluster infowindow
  6. google maps marker cluster
  7. google map marker cluster tutorial
  8. google map marker cluster tutorial android
  9. google maps marker cluster options
  10. google map marker cluster same location
  11. google maps marker cluster demo
  12. google maps marker clustering example
  13. google map marker cluster click event
  14. google map marker cluster infowindow
  15. google maps marker cluster color
  16. google maps marker cluster icons

Perhaps I'm thinking about this in a view too shadowed by the JVM, but… I'm using a third-party API which has a function declaration that takes a WriteStream (I believe it only uses the .write() ...

Perhaps I'm thinking about this in a view too shadowed by the JVM, but… I'm using a third-party API which has a function declaration that takes a WriteStream (I believe it only uses the .write() ...

  1. whataburger
  2. whatsapp
  3. what time is it
  4. what is my ip
  5. what is a bear market
  6. what song is this
  7. what is a national emergency
  8. what is a dry cough
  9. what stocks to buy today
  10. what to watch
  11. whataburger menu
  12. what is the weather
  13. what does ���� mean
  14. what is rsv
  15. what to buy for flu pandemic
  16. what is gluten
  17. what is pv
  18. what is a boomer
  19. what we do in the shadows
  20. what is lupus